文档介绍:其实例表示对对数据库的连接
<?xml version="" encoding="UTF-8"?>
<persistence version=""
xmlns="http://java./xml/ns/persistence"
xmlns:xsi="1/XMLSchema-instance"
xsi:schemaLocation="http://java./xml/ns/persistence http://java./xml/ns/persistence/">
<persistence-unit name="JPA_Hibernate">
<.</provider>
<.</class>
<properties>
<property name="" value=""/>
<property name=""
value="jdbc:sqlserver://localhost:1433;DatabaseName=BS_DLERP;SelectMethod=Cursor"/>
<property name="" value="sa"/>
<property name="" value="111111"/>
<property name="" value=""/>
<property name="" value="true"/>
</properties>
</persistence-unit>
<persistence-unit name="JPA_OpenJPA">
……..
</persistence-unit>
</persistence>
Persistence
EntityManagerFactory
EntityManager
EntityTransaction
Query
其实例代表对数据库的一个连接。
一个数据库连接中最多只能有一个活动的事务对象—EntityTransaction。
EntityManager em = ();
try
{
// TODO: Use the EntityManager to access the database
}
Finally
{
();
}
Persistence
EntityManagerFactory
EntityManager
EntityTransaction
Query
Ent