1 Reply Latest reply on Oct 27, 2006 12:50 AM by joeyli

    Can I reference or inheritance between two jar files?

    joeyli

      I have two EJB3 subsystem:
      Auth system: was packed in auth.jar file
      and
      Order system: was packed in order.jar file

      Now, I have a entity bean that's name is EOlocation, and it was packed in auth.jar:

      @Entity
      @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
      public class EOlocation implements Serializable {
      @ManyToOne
      @JoinColumn(name = "eoaccount_id")
      private EOaccount account;
      .....
      }


      Another entity bean is EOorderLocation, it's a subclass for EOlocation, but was packed in order.jar

      @Entity
      public class EOorderLocation extends EOlocation {
      .......
      }

      I am deploy the auth.jar before than deploy the order.jar file.
      Than I get the exception like the following:

      15:15:15,897 WARN [ServiceController] Problem starting service persistence.units:unitName=EatOutDS
      org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.tweatout.auth.domain.EOlocation.account references an unknown entity: com.tweatout.auth.domain.EOaccount
      at org.hibernate.cfg.FkSecondPass.doSecondPas(FkSecondPass.java:40)
      at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(Annotatio
      nConfiguration.java:288)
      at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1034
      )
      at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.j
      ava:1015)
      at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerCo
      nfigurator.java:154)
      at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Co

      How can I implement the reference or inheritance entity bean between two jar files?

        • 1. Re: Can I reference or inheritance between two jar files?
          joeyli

          This issue was solved:

          I add the following statement into the persistence.xml in order.jar:

          <jar-file>../EatOutEJB3auth.jar</jar-file>

          The content like following:

          <?xml version="1.0" encoding="UTF-8"?>

          <persistence-unit name="EatOutDS">
          <jta-data-source>java:/EatOutDS</jta-data-source>
          <jar-file>../EatOutEJB3auth.jar</jar-file>



          </persistence-unit>