Let me restate your situation to confirm I understand it. You have
a small example working in Equinox OSGi with dynamic weaving, the
bundle start levels are set as per the wiki example, and you have the
Equinox framework extension declared. A larger example with the same
configuration fails with various errors.
Can you answer these questions:
Are all your entities listed in your persistence.xml?
How are the entities and persistence.xml packaged? Are they in the
same bundle or spread out?
In which bundle did you declare the JPA-Persistence-Units property?
How are you creating an EntityManagerFactory?
And can you post your persistence.xml and the console log?
On 5/5/2010 8:13 AM, Caspar MacRae wrote:
When I run unit tests for my JPA (pax Construct) project (using
javax.persistence.Persistence.createEntityManagerFactory) the tests
pass as expected, however when the same is deployed to Equinox (looking
up and using javax.persistence.spi.PersistenceProvider) it fails
repeatedly with variations of:
ValidationException: Exception Description: [class x.y.z.Abc] uses a
non-entity [class x.y.z.Bcd] as target entity in the relationship
attribute [field b].
(Toplink error code # 7250).
In the persistence.xml I declare:
<property name="eclipselink.orm.throw.exceptions " value="false"
I'm using standard JPA annotations with no orm.xml.
I have a very simple test app that works fine (in unit tests and with
equinox) with the org.eclipse.persistence.jpa.PersistenceProvider
implementation, the only notable difference between my toy test app and
the full scale app I'm trying to migrate is the JPA entities, but as
the JPA appears to be fine outside of the OSGi environment (ie. I can
get a PersistenceUnit) I'm a bit stuck as to the cause..
A big difference (though likely an effect rather than cause) is that
the dynamic weaving fails in full scale app - but only when attempting
to use the entities not during the actual weaving (logging is set to
FINEST). When attempting to use dynamic weaving (which works perfectly
in the toy test app), the console is filled with exceptions of the form:
[EclipseLink-60] ... The method [_persistence_set_xxxx_vh] or
[_persistence_get_xxxx_vh] is not defined in the object [x.y.z.Abc].
[EclipseLink-93] ... The table [abc] is not present in this
Although the table abc is generated in the dB.
[EclipseLink-41] ... A non-read-only mapping must be defined for the
sequence number field.
Although the table it refers to has a correct primary key BIGINT AUTO
INC (defined in generic superclass (with generic type for ID, typically
Long throughout the app)
Also I've noted the following:
[EL Finer]: 2010-05-05 12:19:27.805--Could not initialize Validation
Factory. Encountered following exception:
I've played with various settings for properties: eclipselink.weaving,
eclipselink.weaving.lazy and eclipselink.weaving.fetchgroups all to no
avail. So without weaving (guessing it's proxy based) the unit tests
work fine but I can't even acquire a EntityManagerFactory inside OSGi,
as i get PersistenceUnitLoadingException -> Predeployment of
PersistenceUnit [xxxx] failed.
I've tried using eclipse link versions 2.0.2, 2.1.0-M6 and 2.1.0-M7
using Equinox via a pax-construct maven build (pax runner v 1.4.0), and
get virtually the same results with each eclipselink version (although
the latest 2.1.0-M7 seems to completely ignore the @Column(name =
"please_use_this_lower_case_name") annotations when generating the
I'm open to the fact that it may well be my bad config/poor
understanding, but as it's possible to get a PersistentUnit outside of
Equinox I suspect it's a deeper problem.
Any suggestions would be most gratefully received as I am completely
stumped - I'm about to try manually editing the schema but after this
it seems I've only two options; debug the eclipselink code or try a
wrapped hibernate implementation (i prefer the former however this
project is now quite behind).
eclipselink-users mailing list
Shaun Smith | Principal
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