JpA persistence.xml文件
?
mysql 驱动包 版本 5.1.7
?
<?xml version="1.0"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
??? xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
??? xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
??? ????? http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
??? version="1.0">
? <!-- 持久化单元,就是一些实体的集合??? 事务类型为本地事务 -->
? <persistence-unit name="itcast" transaction-type="RESOURCE_LOCAL">
?
? ?? <!-- JPA的驱动,就类似JDBC的驱动,是跟JPA实现对接的入口类 -->
? ?? <provider>org.hibernate.ejb.HibernatePersistence</provider>
? ???? <properties>
???????? <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
???????? <property name="hibernate.connection.driver_class" value="org.gjt.mm.mysql.Driver"/>
??<property name="hibernate.connection.username" value="root"/>
???????? <property name="hibernate.connection.password" value="000000"/>
???????? <property name="hibernate.connection.url" value="jdbc:mysql://127.0.0.1:3306/itcast?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8"/>
???????? <property name="hibernate.hbm2ddl.auto" value="create"/>
???????? <property name="hibernate.show_sql" value="true"/>
???????? </properties>
? </persistence-unit>
?
</persistence>
?
?
oracl
?
<?xml version="1.0"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
??? xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
??? xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
??? ????? http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
??? version="1.0">
?<!-- ??
? <persistence-unit name="chijiu" transaction-type="RESOURCE_LOCAL">
? ?? <provider>org.hibernate.ejb.HibernatePersistence</provider>
????????? <jta-data-source>jdbc/web</jta-data-source>
? ?? <properties>
???????? <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
???????? <property name="hibernate.hbm2ddl.auto" value="create"/>
???????? <property name="hibernate.show_sql" value="true"/>
????????? <property name="hibernate.query.factory_class"? value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
??? </properties>
? -->??
???
???
????
???
? <persistence-unit name="chijiu" transaction-type="RESOURCE_LOCAL">
? ?? <provider>org.hibernate.ejb.HibernatePersistence</provider>
? ?? <properties>
???????? <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
???????? <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
???????? <property name="hibernate.connection.username" value="webuser"/>
???????? <property name="hibernate.connection.password" value="webuser"/>
???????? <property name="hibernate.connection.url" value="jdbc:oracle:thin:@192.168.1.34:1521:edugate"/>
???????? <property name="hibernate.hbm2ddl.auto" value="update"/>
???????? <property name="hibernate.show_sql" value="false"/>
????????? <property name="hibernate.query.factory_class"?
????????? ?value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
</properties>
?
?
?
</persistence-unit>
</persistence>