[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - How to deploy EJB3 Entity Bean into PersistenceUnit dynamica

emilrad do-not-reply at jboss.com
Wed Nov 1 08:45:00 EST 2006

I defined a persistence unit that manage various entity beans.
I need to find a way to deploy an entity bean into that persistence unit during runtime.
In other words, the Persistence Unit will load various entity beans at startup (as defined in persistence.xml),
but after startup, certain operations of the user would cause
the PersistenceUnit to mange additional entity beans.

One may ask, why I don't deploy everything from the begining,
and the answer is that these beans does not exist at that time.

My first try was to simply put the new generated class in the lookup directory and then redeploy the application 
(touching application.xml within my code).
Indeed this cause the new entity bean to be deployed, 
but then the application is down for certain time and all other clients lost their connection with the server.

Instead I'd like to write a method that will be called by the client (via session bean), 
and will call an Hibernate/EJB3 methods that will hopefully "inject" another entity bean into the PersistenceUnit.
During that time other clients should be able use the application regulary.

The question is realy about how can I add Entity Beans to be manged by the Persistence Unit during runtime.

Thanks in advance.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982367#3982367

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982367

More information about the jboss-user mailing list