[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: JPA (hibernate) entity mapping problem in ear

tperrigo do-not-reply at jboss.com
Wed May 27 15:34:45 EDT 2009


I figured out why the relationships in the deployed jar were not working, but I'm not sure if it is due to a bug in JBoss or if it is intentional.  Basically, we have a jar file of entities which are mapped using annotations _except_ for the primary key generation strategy-- we are using the entities against multiple databases, so we put the id generation strategy for each entity in an orm.xml file.  We have one schema, though, where the entities are _completely_ mapped using only annotations, so the entities for that schema do not appear in the orm.xml file.  When we use this setup in a JavaSE application, it works fine-- the entities are discovered and mapped using annotations, and the orm.xml file provides the primary key generation strategy for those entities that need it.  When I deployed the jar and orm.xml file as part of an ear file in JBoss, however, it failed to find any entities that were not in the orm.xml file (the entities that were completely mapped using annotations, and thus did not need to be in the orm.xml file).  Once I added these entities to the orm.xml file, everything worked as expected-- JBoss found the entities that were "missing" and keeping the bidirectional relationships from working.

Is this the expected behavior with JBoss?  If an orm.xml file is used, do _all_ entities need to be in it, even if they are completely mapped using annotations?  Why does this behavior differ from using hibernate/JPA in a JavaSE environment?

Although I was able to get around the issue I was having, I would really like to understand why it was happening in the first place.  I would really appreciate any help answering these questions...the difference in behavior between JavaSE and JavaEE environments is troubling.

Thanks in advance,
Tim Perrigo



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

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




More information about the jboss-user mailing list