[jboss-user] [JBoss Seam] - Persistence context invocation upon application startup

fady.matar do-not-reply at jboss.com
Fri Jan 4 05:08:11 EST 2008


I'd like to run a couple of queries in the startup of the application.

The persistence context can be used only in session beans and message
driven beans. Any ideas how to invoke the persistence context or is
there any alternative approach to get hold of the persistence mechanism
upon startup?

Ideally I would like to have something like:

@Scope(ScopeType.APPLICATION)
@Startup
public class QueryStartup extends Jbpm {
    @PersistenceContext
    EntityManager em;   
    
    @Create
    public void startup() {
         Query q = "some query in here"
         em.createQuery(q).getResultList();
    }
}

Any suggestions?

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

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



More information about the jboss-user mailing list