You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by cws <in...@jyvy.net> on 2008/03/01 20:32:45 UTC

Re: Dynamic Persistence Unit in SE

>
> In Java SE, this is trivial: simply do not list persistent types,
> jars, or mapping files in your persistence.xml file. Dynamic class
> loading is discussed in the docs [1].

For an unknown type to be persisted, forward mapping must be applied, 
but the docs (7.1.3) state: "In order to enable automatic runtime 
mapping, you must first list all your persistent classes as described in 
Section 1, 'Persistent Class List'."  So it seems I have to list them 
and not list them (!).  Is this an oversight? 

It would be so convenient if runtime forward mapping worked without 
listing classes.  I suppose I could write a script that fires the 
mappingtool on any new entity classes I see...  Is there another 
approach for forward mapping of unknown, classloaded types? 


> >
> >  brief: I want to add an unknown entity to my running PU in JavaSE.
> >
> >  My JavaSE client app needs to load new, unknown entities (classes, not
> >  objects) from a trusted URLClassLoader.  I would like to add these new
> >  entities to the existing PU, but this doesn't seem possible in SE
> >  without changing the persistence.xml and restarting.  As a kludge I can
> >  send a persistence.xml with the class and create a new PU, but that
> >  doesn't allow interaction with unknown entities in the existing PU.
> >
>