users@glassfish.java.net

Re: Persisting entities that are loaded at runtime

From: <glassfish_at_javadesktop.org>
Date: Mon, 24 Nov 2008 19:08:13 PST

> Is there a way to register the Class object with
> Persistence or the EntityManagerFactory? I'm
> relatively new to Glassfish/TopLink Essentials/JPA so
> any help would be appreciated.

You could try to use jar-file tag inside of persistence.xml.

From documentation:
 The jar-file element specifies another jar you want automatically scanned for @Entity classes. When using jar-file, you must specify a path relative to the jar file the persistence.xml file is in. By default also, the jar the persistence.xml file is placed in is scanned for @Entity classes as well.
------------------------------------------------------------------

Let me know if it will work for you because I'm interesting in this kind of experiment.
Also keep in mind you could have complete declaration of entities in orm.xml but how it will work if this xml file will be changed or reloaded at runtime I really don't have idea.

Best Regards,
Vladimir
[Message sent by forum member 'vladperl' (vladperl)]

http://forums.java.net/jive/thread.jspa?messageID=318533