Add entities programmatically [message #1233653] |
Mon, 20 January 2014 07:50 |
|
Hey all,
with hibernate i can add entities programmatically this way:
sessionFactory = new AnnotationConfiguration()
.addPackage("test.animals")
.addAnnotatedClass(Flight.class)
.addAnnotatedClass(Sky.class)
Is there something similar in EclipseLink?
This question is often asked but i could not find a satisfing answer. One answer said Dynamic JPA could be a solution but the description says:
"map relational tables to virtual classes which are created dynamically at runtime"
My classes are not created dynamically, they are already existing, but have to be registered at the entityManager.
Thanks for any help in advance,
Thomas
|
|
|
Re: Add entities programmatically [message #1234628 is a reply to message #1233653] |
Wed, 22 January 2014 12:17 |
|
Hey all,
ok maybe i try to ask another way:
I have a persistence bundle "P" which contains my JPA persistence.xml and of course a persistence service using an EntityManager to persist and load data from my database.
In addition i have two bundles "A" and "B" which contain JPA annotated pojos which i want to store.
How can i register the classes of bundle "A" and "B" at the entitymanager without having them defined in the persistence.xml which would crash the modularity of my application.
Note that i´m using EclipseLink.
Thanks alot for all advices, hints and so on.
Greetz
Thomas
|
|
|
|
Re: Add entities programmatically [message #1234976 is a reply to message #1234809] |
Thu, 23 January 2014 09:14 |
|
As i understood the composite persistence unit is mainly for using different database. The requirement to define the Plugins (or more concrete: jar files) "A" and "B" in the composite persistence unit crushes the modulartiy again...
Anyway thanks for the hint.
|
|
|
|
Powered by
FUDForum. Page generated in 0.05876 seconds