4 Replies Latest reply on Oct 2, 2006 11:12 AM by Richard Leherpeur

    Populate pojoCache from Database at startup

    Richard Leherpeur Novice


      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:

      @Startup(depends = {"pojoCache"})
      public class MyComponent {
       privatePojoCache pojoCache = org.jboss.seam.core.PojoCache.instance();
       private EntityManager entityManager;
       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"
       <property name="persistenceUnitJndiName">java:/EntityManagerFactories/myDB</property>

      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.