seam - entitymanger return null when putting in generic dao -


I am using SIM with the Tomcat and IceFace, the problem occurs when I inject unit manager to component bean I give this blank return to Generic DAO, my code is like this:

this bean

  @ scope (scoptype page) @name ("testbene") public Class test bean {public zero test (action event action events) {rolls unit = new roles (); Entity.setName ("opposition"); Roles Dao Dao = new roles (); Dao.emPrisit (unit); }}  

DAO

  Public class Ralsadao {@In EntityManager em; Public Zero emPrisit (roles unit) {em.persist (unit); }}  

Component.xml

  & lt; Persistence: unit-manager-factory name = "booking database" /> & Lt; Persistently: Managed-Persistent-Reference Name = "AM" Auto-Vs = "True" Unit-Manager-Factory = "# {Booking Database}" />  

persistence.xml

  & lt; Persistence Unit Name = "Booking Database" Transaction Type = "RESOURCE_LOCAL" & gt; & Lt; Provider & gt; Org.hibernate.ejb.HibernatePersistence & lt; / Provider & gt; & Lt; JTA-Data-Source & gt; Java: Computer Application / env / ap & lt; / JTA-Data-Source & gt; & Lt; Properties & gt; & Lt; Property Name = "transaction.flush_before_completion" value = "true" /> & Lt; Property Name = "transaction.factory_class" value = "org.hibernate.transaction.JDBCTransactionFactory" /> & Lt; Property Name = "hibernate.connection.driver_class" value = "com.mysql.jdbc.Driver" /> & Lt ;! - & lt; Property Name = "hibernate.transaction.manager_lookup_class" value = "org.hibernate.transaction.JBossTransactionManagerLookup" /> - & gt; & Lt; / Properties & gt; & Lt; / Persistence unit & gt;  

If I do not inject the creator of the unit in Bean, then it fixes the second problem when I add this annotation to the antimension

  @PersistenceContextIn (type = PersistenceContextType .EXTENDED) EntityManager;  

This can give exception to

  due to: java.lang.IllegalArgumentException: @ Precision contact only used on session bean or message driven bean component Can be done: testBean Org.jboss.seam.Component.checkPersistenceContextForComponentType (component.java:901) at org.jboss.seam.Component.scanField (component.java:877) at org.jboss.seam.Component.initMembers At (component.java trishion)) org.jboss.seam.Component at org.jboss.seam.init On & lt; Init & gt; (Component.java 44) org.jboss.seam.Component. & Lt; Init & gt; (Component.java 205). Initialization.addComponent (Initialization.java1186) ... 13 more  

Both code> EntityManager are not required on @In and @ParanceContex . It is enough with one of them.


Comments