0 Replies Latest reply on Oct 29, 2006 4:05 AM by argomauro

    EntityManager problem...Urgent

    argomauro

      Hi,
      I've a problem with EntityManager configuration on my Seam project,because when i use the Entity manager components, Jboss retrive an EntityMangaer not bound exception.
      My persistence.xml file is:

      <persistence-unit name="DAPem">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>java:/MysqlDS</jta-data-source>
       <property name="hibernate.show_sql" value="true" />
       <!-- These are the default for JBoss EJB3, but not for HEM: -->
       <property name="hibernate.cache.provider_class"
       value="org.hibernate.cache.HashtableCacheProvider" />
       <property name="hibernate.transaction.manager_lookup_class"
       value="org.hibernate.transaction.JBossTransactionManagerLookup" />
       <property name="jboss.entity.manager.factory.jndi.name"
       value="java:/DAPem" />
       </persistence-unit>
      

      My components.xml file is:
      <components>
       <component name="org.jboss.seam.core.init">
       <property name="myFacesLifecycleBug">true</property>
       <property name="jndiPattern">DAP/#{ejbName}/local</property>
       </component>
       <!-- 120 second conversation timeout -->
       <component name="org.jboss.seam.core.manager">
       <property name="conversationTimeout">120000</property>
       </component>
      
       <component class="org.jboss.seam.core.Ejb" installed="false" />
      
       <component name="em"
       class="org.jboss.seam.core.ManagedPersistenceContext">
       <property name="persistenceUnitJndiName">
       java:/DAPem
       </property>
       </component>
      </components>
      


      The code where I call the "em" component is:
      public Object getAsObject(FacesContext facesContext,
       UIComponent component,
       String str)
       throws ConverterException{
       Object objReturn = null;
       if (str == null || str.length()==0 || EMPTY.equals(str)) {
       return objReturn;
       }
       EntityManager em = (EntityManager)Component.getInstance("em", true);
       EntityProfilo profilo = (EntityProfilo)em.find(EntityProfilo.class,new Integer(str));
       objReturn = profilo;
       return objReturn;
       }
      

      I've read The Seam Reference Guide, step to step in the percistence section, but my application don't work.
      If you have an idea or if i have ommitted something, please help me.
      Thanks...