 |
| |
|
Spring+JPA+MySQL的配置文件 |
 |
|
时间:2008年07月02日 作者: 河外科技 |
一直在整合spring+hibernate,现在整合一下JPA +Spring persistence.xml 默认放在 META-INF 目录下 Xml代码 <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 persistence_1_0.xsd" version="1.0"> <persistence-unit name="java2000" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>MyClass</class> <properties> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" /> <property name="show_sql" value="true" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.use_query_cache" value="false" /> </properties> </persistence-unit> </persistence> view plaincopy to clipboardprint? <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 persistence_1_0.xsd" version="1.0"> <persistence-unit name="java2000" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>MyClass</class> <properties> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" /> <property name="show_sql" value="true" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.use_query_cache" value="false" /> </properties> </persistence-unit> </persistence> <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 persistence_1_0.xsd" version="1.0"> <persistence-unit name="java2000" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>MyClass</class> <properties> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" /> <property name="show_sql" value="true" /> <property name="hibernate.cache.use_second_level_cache" value="true" /> <property name="hibernate.cache.use_query_cache" value="false" /> </properties> </persistence-unit> </persistence> applicationContext.xml Xml代码 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
相关新闻:
|
| | |