-
1. Re: Seam tests with TestNG eclipse plugin
shoe54 May 31, 2010 3:58 AM (in response to kyatim)I am experiencing the same thing. I can't persist my entity if I have 2 ejbs. For example, if my Eclipse workspace structure is:
- EJB1.ejb
- EJB2.ejb
- War.war
- Ear.ear (depends on both EJB1 and EJB2)
- Project-testThen running a test in Project-test via the TestNG plugin will fail on the persist():
java.lang.IllegalArgumentException: Unknown entity: com.test.entity.Role
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:223)The Role entity lives in EJB2. Running this as a deployed app in JBoss 5.1.0 GA works with no problems. I am using Seam 2.2.0.
If I remove EJB1 then the TestNG test will work.
-
2. Re: Seam tests with TestNG eclipse plugin
shoe54 May 31, 2010 12:16 PM (in response to kyatim)Sorry the project structure list didn't format correctly. Here it is again:
- EJB1.ejb - EJB2.ejb (this is where my entity lives) - War.war - Ear.ear (depends on both EJB1 and EJB2) - Project-test
I have more information. It looks like each EJB has a SessionFactoryImpl. When the SessionFactory is initialized it only reads entities from the same EJB. So the SessionFactoryImpl for EJB1 knows of no entities. When debugging into the persist code it looks like it consults the SessionFactoryImpl for EJB1, therefore has no knowledge of my entity that lives in EJB2. In a real deployment I can use the jar-file element in persistence.xml to handle this. Is there an equivalent for this in a TestNG SeamTest?