一、JPA用来替代hibernate ⒈JPA的全称是JAVA Persistence API。指的是JPA通过注解或者是 ⒉JPA是一种规范,hibernate是一种实现。同样的mybatis也是jpa中的一种实现。 二、构建步骤: ⒈创建persistence. ...
一、JPA用来替代hibernate
⒈JPA的全称是JAVA Persistence API。指的是JPA通过注解或者是
⒉JPA是一种规范,hibernate是一种实现。同样的mybatis也是jpa中的一种实现。
二、构建步骤:
⒈创建persistence.
⑴、首先在你的项目中的src目录下新建一个MATA-INF文件夹,文件夹的名字不可以是任意,必须是MATA-INF:
⑵、新建一个
⑶、接下来,在persistence.
<? ="http://www.w3.org/2001/ xsi:schemaLocation="http://// version="2.1"> <!--persistence单元,name属性不可少。 --> <persistence-unit name="myJpa" transaction-type="RESOURCE_LOCAL"> <!--可选属性:设置persistence的提供者 --> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <!--可选属性:实体类 --> <class>entity.BookCard</class> <!-- 数据库厂商的属性 --> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServer2008Dialect"/> <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> <property name="hibernate.connection.username" value="sa"/> <property name="hibernate.connection.password" value="123456"/> <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost:1433;DatabaseName = webLastExam_20160727"/> <property name="hibernate.show_sql" value="true"></property> <property name="hibernate.hbm2ddl.auto" value="update"/> </properties> </persistence-unit></persistence>
原标题:ssh(sturts2_spring_hibernate) 框架搭建之JPA代替hibernate
关键词:Spring
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。