[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - AbstractEntityManagerImpl.persist in Embeddable EJB 3.0 usin

christophe.laumond do-not-reply at jboss.com
Thu Sep 14 02:19:25 EDT 2006


Hi all,

I'm using Seam 1.0.1GA which means Hibernate as persistence layer.

I have done a TestNG test for testing my Data Access EJB which are using hibernate using the SeamTest class.
This means that my Data Access EJB is deployed and my test is accessing it as a Seam component.

TestNG is using Microcontainer and Embeddable EJB3.

According to the log trace, the following hibernate version are used :

Hibernate EntityManager 3.2.0.CR1
Hibernate Annotations 3.2.0.CR1
Hibernate 3.2 cr2

The test is working perfectly when I use the compiled class files directly.

Then I have packed the classes files in two different jar files :
- the first contains the Entities
- the second contains the Data Access Objects using the EntityManager

I got the following error :

anonymous wrote :  [testng] ERROR 14-09 09:54:35,609 (Log4JLogger.java:error:119)  -persist failed
  |    [testng] java.lang.IllegalArgumentException: Unknown entity: accountingAudit.businessObjects.Publicationstatus
  |    [testng] at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:189)
  |    [testng] at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:175)
  |    [testng] at accountingAudit.dataAccessObjects.PublicationstatusHome.persist(PublicationstatusHome.java:38)

my entity in the first jar files

@Entity
  | @Table(name = "publicationstatus", catalog = "accountingaudit", uniqueConstraints = {})
  | public class Publicationstatus implements java.io.Serializable {
  | ...
  | }

My DAO in the second jar files


  | @Stateless
  | @Name("publicationstatusDAO")
  | @Interceptors(SeamInterceptor.class)
  | @Local
  | public class PublicationstatusHome implements PublicationStatusLocal {
  | 
  | 	private static final Log log = LogFactory
  | 			.getLog(PublicationstatusHome.class);
  | 
  | 	@PersistenceContext(unitName="entityManager")
  | 	private EntityManager entityManager;
  | 
  | 	public void persist(Publicationstatus transientInstance) {
  | 		log.debug("persisting Publicationstatus instance");
  | 		try {
  | 			entityManager.persist(transientInstance);
  | 			log.debug("persist successful");
  | 		} catch (RuntimeException re) {
  | 			log.error("persist failed", re);
  | 			throw re;
  | 		}
  | 	}
  | 

So, obviously this due to the packing in the jar file.

But I don't know if this is due to a missing Hibernate annotations, an error in the Embeddable EBJ3 or anything else...

Any help would be greatly appreciate.

Thanks in advance

Christophe Laumond,
M-ITC Ltd,
Mauritius
I don't know if the error 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971468#3971468

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971468



More information about the jboss-user mailing list