I'm trying to integrate an library to an other one, the following code is the content in jpa-config.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="packagesToScan" value="com.example1" />
<property name="persistenceProviderClass" value="org.eclipse.persistence.jpa.PersistenceProvider" />
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="jpaAdapter" />
<property name="jpaPropertyMap">
<map>
<entry key="eclipselink.weaving" value="false" />
<entry key="eclipselink.logging.level" value="INFO" />
<entry key="eclipselink.logging.level.sql" value="INFO" />
<entry key="eclipselink.cache.shared.default" value="false" />
</map>
</property>
</bean>
</beans>
I'm just wondering if I can do something like this:
<property name="packagesToScan">
<list>
<value>com.example1</value>
<value>com.example2</value>
</list>
</property>
You can specify multiple packages to scan with below (as included in your question):
<property name="packagesToScan">
<list>
<value>com.example1</value>
<value>com.example2</value>
</list>
</property>
The packagesToScan
attribute is there for xml less configuration ie. no persistence.xml... When using a persistence xml it follows the JPA spec.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.