Both of these frameworks are written by a great God. Used to do single-table additions and deletions, Shuangshuang. But complex queries do not yet know how to use them, so I also write service maperr in the traditional way, write SQL to handle complex queries, and query with multiple tables. Its complex query is a bit like hiberate's conditional query. But hibernate has not written for a long time, have forgotten.Framework for Universal Mapper
Idea ran an error while running the SSM projectOrg.apache.ibatis.binding.BindingException:Invalid bound statement (not found)Cause: There is no mybatis configuration file in target after deployment *.xmlWORKAROUND: Force the *.xml file to be published together with Maven in Pom.xmlIntelliJ idea can't find mapper through MAVEN building the SSM project
The SQL file in MyBatis is not directly written for greater than or equal to or less than equals. = or 1. Escape by symbol:Escape character
Less than sign
gt;
>
Greater than sign
amp;
And
apos;
’
Single quotation marks
quot;
"
Double quotes
2. By identifier:UseSELECT Newsedit,newsid, newstitle from Shoppingguide WHERE 1=1 and Newsday > #{starttime} and Newsd
Reprinted from: http://blog.csdn.net/szwangdf/article/details/26714603By default, using the #{} syntax, MyBatis produces preparedstatement statements, and safe settings PreparedStatement parameters, which mybatis perform the necessary security checks and escapes.Example 1:Execute Sql:select * from emp WHERE name = #{employeename}Parameter: Employeename=>smithParsed after executing sql:select * from emp where name =?Execute Sql:select * from emp WHERE name = ${employeename}Parameter: EmployeeName
First, create a MAVEN project with Eclipse.Second, under the Pom.xml file, add the following plug-in configuration:xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > //maven.apache.orgtruetrueThird, find the configurationfile tag from Pom.xml, and follow the path on the label (Src/main/resources/generator.xml) into the core configuration file of the following generated code, Generator.xml:Four, cmd Open the DOS window, to the root path of the proje
1. Download the package addresshttp://download.csdn.net/detail/u012909091/72060912. Download and unzip the file to any directory3. Delete all files under mybatis-generator-core-1.3.2\mybatis-generator-core-1.3.2\lib\src 4. Modify the configuration file Mybatis-generator-core-1.3.2\mybatis-generator-core-1.3.2\lib\generatorconfig.xml file"Jdbc:mysql://localhost:3306/generator" userid= "root" password= "249832" >tablename= "test" domainobjectname= "test" enablecountbyexample= "false" enableupdateb
parametertype: Parameter type, can be omitted, gets the value of the self-increment primary key: MySQL supports the self-increment primary key, the self-increment primary key value obtains, MyBatis also uses Statement.getgenreatedkeys (); Usegeneratedkeys= "true"; Gets the primary key value policy using the self-increment primary key Keyproperty Specifies the corresponding primary key attribute, that is, after MyBatis obtains the primary key value, encapsulates the value
the thin_pool_autoextend_percent for when thin pool autoextension occurs.
The value ' s setting is the perentage of space to increase the thin pool (+ disabled)
Thin_pool_autoextend_percent = 20
8.Check your work, your docker-thinpool.profile file should appear similar to the following:
An example/etc/lvm/profile/docker-thinpool.profile file:
Activation {Thin_pool_autoextend_threshold=80Thin_pool_autoextend_percent=20}9. Submit the LVM configuration file
$ sudo lvchange--metadataprofile docke
In the MyBatis configuration file, note that the Pagehelper plugin is written in front of the general mapper
Otherwise it will be reported
Org.mybatis.spring.MyBatisSystemException:nested exception is Org.apache.ibatis.builder.BuilderException:Error Invoking SQLProvider Method (Com.github.abel533.mapper.MapperProvider.dynamicSQL). Cause:java.lang.InstantiationException:com.github.abel533.mapper.MapperProviderAt Org.mybatis.spring.MyBatisExceptionTran
In Red Hat Enterprise Linux4, set the multi-path management of device-mapper-Linux Enterprise Application-Linux server application information. For more information, see the following. Related versions: Red Hat Enterprise Linux 4 UPDATE 2 requires a complete OS upgrade to set device-mapper-multipathing. Earlier Red Hat Enterprise Linux 4 did not include this function. Edit the/etc/multipath. conf file. Comm
Some special symbols in XML need to be escaped as content information, otherwise it will affect the legality and use of the file.HTML code
gt; >
amp;
apos; ‘
quot; "
When writing SQL statements in the mapper file, it is recommended to use XML code
select id="Getaccountsbybranch" resulttype="account" parametertype="string" >
Select>
use XML code
select id= "getaccounterrorcount" result
Http://www.ibm.com/developerworks/cn/linux/l-devmapper/index.html
This page introduces some principles. You can take a look.
Dmsetup command
Displays information about the current device mapper.
Dmsetup ls
Dmsetup info
Dmsetup status
Display Device Dependencies
Dmsetup deps
Sda4_crypt: 1 dependencies: (8, 4)Vg_richard-lv_home: 1 dependencies: (253, 0)Vg_richard-lv_swap: 1 dependencies: (253, 0)Vg_richard-lv_root: 1 dependencies: (253, 0)
Let's take
, default false disabled - when rationalized is enabled, if pagenum - when rationalized is disabled, if pagenum - Propertyname= "reasonable"value= "true"/> 3.5. Version 0 available-in order to support the StartPage (Object params) method - added a ' params ' parameter to configure parameter mapping to take values from map or ServletRequest - Pagenum,pagesize,count,pagesizezero,reasonable,orderby can be configured, not
Http://www.mybatis.org/mybatis-3/zh/sqlmap-xml.html#insert_update_and_deleteorg.apache.ibatis.exceptions.PersistenceException: # # # Error querying database. Cause:org.apache.ibatis.executor.ExecutorException: No constructor found in Tk.mybatis.springboot.model.Course matching [Java.lang.Integer, java.lang.string]### the error may exist in mapper/coursemapper.xml### The error may involve tk.mybatis.springboot.mapper.coursemapper.selectall### the error
The integrated MyBatis can be implemented through Mybatis-spring-boot-starter .Https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -Dependency> groupId>Org.mybatis.spring.bootgroupId> Artifactid>Mybatis-spring-boot-starterArtifactid> version>1.1.1version>Dependency>But the integration of general Mapper seems to be a problem?? Not determined at this stage.Occupied, reserved for follow-up. Spring Boot integrat
MyBatis and Hibernate are persistent layer framework, mybatis appear than hibernate late, both frameworks I have used, for the advantages of both my feelings are not deep, personal feeling mybatis automatically generated model,mapping, The functionality of the mapper file reduces the number of encodings, but it is also prone to errors and is not easy to troubleshoot after an error.I searched the internet for a bit about the comparison between MyBatis
When using MyBatis, the handwritten XML or model file is a definitely work, so you can use the Mybatis-gennerator plugin to automatically generate the DAO, Bean, and mapper XML files needed for MyBatis(Original address: http://blog.csdn.net/tolcf/article/details/50835165)Accessories:http://files.cnblogs.com/files/cc-robot/generator.rarUnzip the attachment locally, I put it in the D:\web\java directory.You only need to modify the underlined portions of
is created by default by the field type in the database and, if present, the Entity class field is created by the name and type specified below. - Ignorecolumn: This property is not created in the entity class - TableTableName= "Blog_user"Domainobjectname= "User"Enablecountbyexample= "false"Enableupdatebyexample= "false"Enabledeletebyexample= "false"Enableselectbyexample= "false"Selectbyexamplequeryid= "false"> - Table> Context>generatorcon
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.