EclipseLink (probably javax.persistence package) cannot find entities classes when they are packages in a separate bundle than the bundle containing the persistence.xml
Remarks :
-They are no conflicts between the two bundles as the packages are well exported and imported
- JDK : 6
- Platform : Apache Felix Karaf 1.2.0 running Felix 2.0.1
Here is the spring / persistence config files
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
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">
<persistence-unit name="report" transaction-type="RESOURCE_LOCAL">
<class>org.apache.camel.example.reportincident.restful.ReportIncidentEntity</class>
<class>org.apache.camel.example.reportincident.restful.DetailEntity</class>
<!-- Eclipse & Derby -->
<properties>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:derby://localhost:1527/report;create=true" />
<property name="javax.persistence.jdbc.user" value="sa" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="eclipselink.logging.file" value="data/eclipsejpa/camel-example-report.log" />
<property name="eclipselink.logging.level" value="FINEST" />
<property name="eclipselink.logging.logger" value="org.eclipse.persistence.logging.DefaultSessionLog" />
<property name="eclipselink.logging.thread" value="true" />
<property name="eclipselink.logging.session" value="true" />
<property name="eclipselink.logging.exceptions" value="true" />
</properties>
</persistence-unit>
</persistence>
and spring file
<context:load-time-weaver weaver-class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="report"/>
<!-- <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" /> -->
<!-- <property name="dataSource" ref="dataSource" /> -->
<property name="jpaVendorAdapter" ref="jpaAdapter" />
</bean>
<!-- TransactionManager -->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<!-- EclipseLink adapter -->
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="org.eclipse.persistence.platform.database.DerbyPlatform" />
</bean>
Regards,
Charles
Charles Moulliard
SOA Architect