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

tperrigo do-not-reply at jboss.com
Tue May 26 14:52:03 EDT 2009


I've got a jar file of JPA entities; they are mapped primarily using annotations, but, since we need to use them against several databases, we map the primary key field for each entity in an orm.xml file (so the key generation strategy can be properly specified; nothing else changes between databases).  

We've been using the entities successfully for quite some time in a Java SE application.  Now, though, as I am attempting to deploy the entity jar in the lib directory of an ear file (and the JPA mapping files in the META-INF directory), I am getting a strange error upon deployment from entities with bi-directional relationships.  For example, we have a Process entity and a ProcessType entity; a Process can have only 1 ProcessType, but a ProccessType can have many associated Processes, so we mapped the bi-directional relationhip between Process and ProcessType as follows:

Process entity:

  | @ManyToOne(fetch=FetchType.LAZY)
  | @JoinColumn(name="process_type_id", nullable=false)
  | private ProcessType processType;
  | 

ProcessTypeEntity:

  | @OneToMany(mappedBy="processType", fetch=FetchType.LAZY)
  | @JoinColumn(name="process_type_id", nullable=false)
  | private Set<Process> processes;
  | 

As I mentioned, we have many relationships of this nature and have been using them without issue in a Java SE application for a couple of months now.  When I attempt to deploy the entity jar (and mapping files) as part of an ear file (in JBoss 5.1.0.GA), I get the following error:

anonymous wrote : 
  | 1:14:11,047 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=opt_process_control.ear/#logos state=Create
  | org.hibernate.AnnotationException: @OneToOne or @ManyToOne on werner.opt.logos.config.Process.processType references an unknown entity: werner.opt.logos.global.ProcessType
  | 

This has me quite confused; I'm not even sure what I can test to narrow this down, since the exact same jar file works elsewhere, and the entities pass all their tests (there's a TestNG unit test for each entity, as well as a test for the bidirectional relationship between Process and ProcessType; all of the tests succeed).  Please, please let me know if you see anything I've missed, or if you have any ideas for me to try.  I truly appreciate your help!

Tim

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

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



More information about the jboss-user mailing list