About Springmvc+mybatis+mysql

Source: Internet
Author: User

MyBatisis one that can be customizedSql, stored procedures, and a persistent layer framework for advanced mappings. MyBatisexcluding most of theJdbccode, manually set parameters, and result sets are re-obtained. MyBatisuse only the simpleXmland annotations to configure and map the base data type,MapInterfaces andPojoto the database record. RelativeHibernateand theApache OJBand other "one-stop"Ormsolution,Mybatisis a "semi-automated"Ormimplementation. need to use theJarPackage:Mybatis-3.0.2.jar(MyBatisCore pack),Mybatis-spring-1.0.0.jar (with theSpringBonding Package).

Mybatis+spring+mysql Simple configuration process:

(1) BuildingSpringEnvironment:JoinSpringframework, configuration files, adding the requiredJarpackage, changingXmland theSpringthe configuration file, addingJsppage and the correspondingController.

(2) in create databases and corresponding tables in MYSQL;

(3) Create an entitybean bean sqlmap file;

(4) Create data access dao< Span style= "FONT-SIZE:14PX; Font-family: Song body; Mso-ascii-font-family:calibri; Mso-ascii-theme-font:minor-latin; Mso-fareast-font-family: Song body; Mso-fareast-theme-font:minor-fareast; Mso-hansi-font-family:calibri; Mso-hansi-theme-font:minor-latin "> interface class;

(5) Ibatis General configuration file,sqlmapconfig.xml;

(6) ModificationSpring 's configuration file, you need to specify the configuration file location andDataSource, the corresponding implementation of the data access interfaceBean.

summary: Java Web Storage images are stored in binary form.

There are two ways to take multiple data: Querydao: A single fetch meets the criteria for more data records. Queryrowdao: Each time a data record is taken out.

userid as UserID//The UserID is normalized to userid .

executeforobject (" ",,)//Take a single data, the first parameter is anchored to SQL, the second parameter is null to mean nothing, and the third parameter is the return type.

${userbean.userid}//Put UserBean.userid The value of the is displayed.

About Springmvc+mybatis+mysql

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.