[jboss-user] [JBoss Seam] - Populate pojoCache from Database at startup
rlhr
do-not-reply at jboss.com
Mon Oct 2 09:28:06 EDT 2006
Hello,
I created a component that is initialized at startup.
This component is supposed to retrieve data from the database and store them in the pojoCache.
The component is defined as:
@Scope(ScopeType.APPLICATION)
| @Intercept(NEVER)
| @Startup(depends = {"pojoCache"})
| @Name("myComponent")
| public class MyComponent {
|
| privatePojoCache pojoCache = org.jboss.seam.core.PojoCache.instance();
|
| private EntityManager entityManager;
|
| @Create
| public void startup() throws Exception {
|
| // get data and store in the cache
| }
| }
|
The entityManager that is also a component defined in the component.xml file as:
<component name="entityManager" class="org.jboss.seam.core.ManagedPersistenceContext">
| <property name="persistenceUnitJndiName">java:/EntityManagerFactories/myDB</property>
| </component>
|
To make sure the entityManager is loaded, I guess I need to add in the startup dependencies "entityManager", but then how do I get an instance of entityManager at this point?
Injection is not working at startup.
Thanks,
Richard
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975482#3975482
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975482
More information about the jboss-user
mailing list