Embedding OpenJPA

2007-05-14 Thread Dennis Thrysøe

Hello,

I'm planning on embedding OpenJPA in a server (which is running in a 
J2EE environment). OpenJPA will run entirely within this server, and 
together with added functionality implement a content container in 
which entities can be depolyed, just as servlets can in a servlet container.


So, I was wondering if anybody here could help me get a little wiser on 
OpenJPA. Does OpenJPA:


- Allow arbitrary instatiation and destruction, without requiring 
anything directly from the J2EE framework?
- Allow dynamic deployment of Entities when they are loaded, or at 
deployment time.
- Allow third parties (not the entity definitions) to define/override 
things such as identity definition, field types (convert when 
reading/writing etc.?


Any thoughts welcome.

-dennis
---
The information in this email is confidential and may be legally protected.



Re: Embedding OpenJPA

2007-05-16 Thread Dennis Thrysøe

Patrick Linskey wrote:

This means that your container would be responsible for EntityManager
lifecycle and potentially for transaction control. It also means that
you'd interact with OpenJPA via the
PersistenceProvider.createContainerEntityManagerFactory() API. In such
a scenario, you (the container) would be responsible for providing a
PersistenceUnitInfo (you might want to take advantage of OpenJPA's
existing XML-processing support to help out with this).


That sounds like the right way to do it. So my container would, on 
startup, instantiate OpenJPA's PersistenceProviderImpl, and invoke 
createContainerEntityManagerFactory() with a PersistenceUnitInfo that I 
implement?


I can see that this gives me a great deal of control over classloading, 
transactions, etc. But it looks like I still need to supply all managed 
class names up front, and must refer to mapping information as file 
references?


I am hoping for a way to enhance and register classes as appropriate at 
ordinary classloading time, or if that isn't possible at least discover 
the classes dynamically at deployment time. Generally I'm trying to 
avoid using persistence.xml.


Likewise the mapping information should only come from annotations on 
the managed classes, but ideally through me such that certain things 
can be changed on the fly (such as field value and type conversion etc.)


Is this possible? Perhaps by providing certain properties in the map 
when obtaining an EntityManagerFactory? Or am I being too creative here?


-dennis
---
The information in this email is confidential and may be legally protected.