In general it would be much better to have all of your persistent classes
defined ahead of time. It is possible through using TopLink Essentials API
to add entity mappings dynamically, but this will not support some
functionality such as dynamic weaving.
In TopLink Essentials you can dynamically add (or even build) descriptors at
runtime, using the TopLink ServerSession API (Server)
addDescriptor(Descriptor), addDescriptors(Vector), addDescriptors(Project).
You can get the TopLink ServerSession from your TopLink EntityManagerFactory
or EntityManager.
The descriptors must be built using TopLink's meta-data (see descriptors,
mappings packages, or project.xml), not JPA annotations or XML (although
there may be internal API to do this).
Marina Vatkina wrote:
>
> There is no spec-supported way of doing it. I don't know if there are
> providers
> who can support this feature.
>
> regards,
> -marina
>
> Farrukh Najmi wrote:
>> Farrukh Najmi wrote:
>>
>>>
>>> Is it possible in JPA to dynamically add POJO's for entity beans to an
>>> existing and active persistent unit?
>>> If so, what is the best way to do this?
>>>
>> Just to be clear, I meant how to add new entity bean classes (not
>> instances) to an active PU so they can be persisted and queried using
>> that instance of the PU.
>> Thanks.
>>
>
>
-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.oracle.com/technology/products/ias/toplink/ Oracle TopLink ,
http://www.eclipse.org/eclipselink/
EclipseLink , https://glassfish.dev.java.net/javaee5/persistence/ TopLink
Essentials
Wiki: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence ,
http://wiki.eclipse.org/EclipseLink EclipseLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink ,
http://www.nabble.com/java.net---glassfish-persistence-f13455.html Glassfish
Persistence
--
View this message in context: http://www.nabble.com/How-to-dynamically-add-entity-beans-to-a-persistent-unit-tf4815853.html#a13838057
Sent from the java.net - glassfish persistence mailing list archive at Nabble.com.