The use and principle analysis of mapper mapping configuration in the above The configuration class is mainly used to store the MyBatis and mapper file parsing data, the configuration object will run through the entire MyBatis execution process, to provide the necessary information for the execution of MyBatis.Let's take a look at the member variables and construction methods of the configuration class: Pac
Tools and backgrounds: IntelliJ idea 2016.1.3 Ultimate. Spring boot, MAVEN project, uses mybatis annotations to query MySQL.Business logic Relationship: Controller-to-service interface----> Serverimpl--->dao-->daoimpl---> Mapper-->dbIssue: Mapper hint Could not autowire. No beans of ... type found?Where Productdaomybatismapper is an interface for querying MySQL with structures such as:workaround : Serialize
Originally to be installed on the virtual machine grpc for testing, the results found that gradle can not be used, and then to install Gradle, install gradle before installing Sdkman, and the official website Sdkman installed half a day did not respond, so think of Yum try, resultsThis was also the case when I ran the spark recommendation system, but I foundThere is still a lot of space, so use DF to see/dev/mapper/cl-root 100%, Instant Meng forced, b
Spring Consolidated MyBatis (Configure mapper proxy with scan package)Pojo is an entity class generated from a table that has the same property name as the field name and an alias for a different SQL statement query.First, lead the jar packageEntity classpublic class User { private Integer id; private String username;// 用户姓名 private String sex;// 性别 private Date birthday;// 生日 private String address;// 地址}
1
2
3
4
5
Criteria.andxxxin (list
Add xxx field value in List
Criteria.andxxxnotin (list
Add XXX field value not list
Criteria.andxxxlike ("%" +value+ "%")
Add a fuzzy query condition with a value of XXX field
Criteria.andxxxnotlike ("%" +value+ "%")
Add a fuzzy query condition with the XXX field value not being value
Criteria.andxxxbetween (value1,value2)
Add the XXX field values between value1 and value2 cond
Method parsing in Mapper interfaceFunctions and methods in the Mapper interface
Method
function Description
int Countbyexample (userexample example) Thorws SQLException
Count by criteria
int Deletebyprimarykey (Integer id) thorws SQLException
Delete by primary key
int Deletebyexample (userexample example) Thorws SQLException
------------I do not have him, but the hand is ripe, humble and foolish, and eager to be hungry-------------Beannameurlhandlermapping and SimpleurlhandlermappingBeannameurlhandlermapping belongs to the SPRINGMVC default processor mapper, which is not worthy of thisBecause it has been configured in the SPRINGMVC configuration fileYou can also configure the beannameurlhandlermapping, but it is useless in your own XML configuration file: class="
Mybatis-generator Code generation Tool (Maven method)
MyBatis Generator Detailed
IntelliJ Idea 14 uses Mybatis-generator to automatically generate MyBatis code
Develop MyBatis reverse engineering with idea
Pom.xml file Configuration
Generatorconfig.xml
Where to modify:
Javamodelgenerator, generate the position of the PO classLocation of Sqlmapgenerator,mapper Map file generationWhere the Javaclientgenerator,ma
Today, when installing MySQL5.5 in the WINDOWS7 system, I get the error "There are no more endpoints available in the MySQL endpoint mapper."650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/8A/AC/wKioL1g3iSuwCWqdAACpAEhH2Jg324.png-wh_500x0-wm_3 -wmp_4-s_1100239043.png "title=" 2016-11-25_083033.png "alt=" Wkiol1g3isuwcwqdaacpaehh2jg324.png-wh_50 "/>The reasons are as follows:650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/8A/B0/wK
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
1.spring launches two important classes of MyBatis: Sqlsessionfactorybean and Mapperfactorybean, all of which are org.mybatis.spring jar packages.is the key to starting MyBatis, why does spring recognize these two classes? Because these two classes implement the spring interface.The point here is that Org.mybatis.spring.SqlSessionFactoryBean and Org.mybatis.spring.mapper.mapperfactorybean[b] implement the spring interface, and produces the object.Org.mybatis.spring.SqlSessionFactoryBeanOrg.mybat
MyBatis of variable references in mapper file #{} vs. ${}By 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 = ${empl
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service