Hi Charles,
You should have no trouble with entities spread across bundles. I
have an example with 3 entities each in their own bundle and a 4th
bundle containing the persistence.xml and the code that creates the
EntityManagerFactory. What you didn't mention in your remarks, but I
can see from your configuration, is that you are using Spring and
Spring's load time weaving support. EclipseLink's Equinox weaving
support prior to version 2.0 does require all entities to be packaged
in the same bundle. Perhaps you can try EclipseLink 2.0 to see if this
solves the problem. However, I suspect the problem is a
Spring/EclipseLink in OSGi problem. Can you post the error you're
seeing?
Shaun
cmoulliard wrote:
EclipseLink 1.2.0 does not work on Apache Felix 2.0.1 platform when the
entities classes are deployed in another bundle than the one containing the
persistence.xml file.
Remark : They are no conflicts between the two bundles as the packages are
well exported and imported
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>
<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
My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
--
Shaun Smith | Principal Product Manager
Phone: +19055023094
Oracle Server Technologies, Oracle TopLink
ORACLE Canada | 110 Matheson Boulevard West, Suite 100, Mississauga,
Ontario | L5R 3P4
Oracle is committed to developing practices and products that
help protect the environment
|