0
我有两个项目: 常见和人力资源管理在jar文件春天JPA自动扫描实体
常见的项目(打包成罐)父项目和人力资源管理是一个相关项目(打包为战争) 依赖通过指定行家
指定Maven的依赖关系为:
<dependency>
<groupId>com.talentera</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
我的XML持久性人力资源管理项目:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="talentera" transaction-type="RESOURCE_LOCAL">
<description>example of enabling the second level cache.</description>
<jta-data-source>java:jboss/datasources/TalenteraDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<jar-file>../../lib/common-0.0.1-SNAPSHOT.jar</jar-file>
<properties>
<property name="hibernate.cache.use_second_level_cache" value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.bytecode.use_reflection_optimizer" value="false" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.use_outer_join" value="false" />
<property name="hibernate.cache.use_structured_entries" value="true" />
<property name="hibernate.generate_statistics" value="true" />
<property name="hibernate.id.new_generator_mappings" value="false" />
<property name="hibernate.default_batch_fetch_size" value="500" />
<property name="hibernate.max_fetch_depth" value="5" />
<property name="hibernate.jdbc.batch_size" value="1000" />
<property name="jboss.as.jpa.managed" value="false" />
<property name="hibernate.archive.autodetection" value="class, hbm"/>
</properties>
</persistence-unit>
</persistence>
Spring配置:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="appDataSource" />
<property name="persistenceUnitName" value="talentera" />
<property name="jpaVendorAdapter">
<bean
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="MYSQL" />
<property name="showSql" value="true" />
</bean>
</property>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
</property>
</bean>
<bean id="jpaTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="appDataSource" />
</bean>
请帮我做共同提供可自动通过弹簧JPA共同
被打包成JAR和人力资源管理中的人力资源管理项目确认的实体打包为战争。
请让我知道,如果我需要在这里提供更多的信息。
谢谢你@skizzo工作。 – Deepak 2015-02-10 06:57:15