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