0 Replies Latest reply on Jun 9, 2006 5:30 AM by Torsten Lunze

    Reading orm.xml

    Torsten Lunze Newbie


      I have my entities splitted among different jar-files and I am also using a mix of annotations and a mapping file.

      Lets say I have a jar file x.jar and root.jar, where root.jar contains the orm.xml file and is dependend on x.jar. The mapping file orm.xml defines additional entities which are both located in x.jar and root.jar.

      My persistence.xml is this (located in root.jar):

       <persistence-unit name="pu">

      Now then deploying JBOSS is first reading x.jar then orm.xml then root.jar and then orm.xml again. During the first read of the orm.xml - then trying to map the class which is defined in root.jar - its complaining

      Use of @OneToMany or @ManyToMany targeting an unmapped class

      This is because the class in root.jar which is mapped in the orm.xml has an association to an entity in root.jar which is not mapped through the orm.xml.

      My question is, why is JBOSS reading the orm.xml file twice, I thought if I have one persistence.xml its first reading all jars, mapping files and then trying to deploy it?

      Do I have to split the orm.xml?

      Thanks for your help!