1 Reply Latest reply on Oct 3, 2005 12:56 PM by Emmanuel Bernard

    Multiple datasource and PARs

    steu marok Newbie

      Hi,
      I'm developing a on-demand web application that use mutiple datasources. The EJB part of the app have this structure:
      - Base classes (Entity - EmbeddableSuperclasses - and sessions)

      @EmbeddableSuperclass
      package app.ejb;
      
      @Table(name="COM_CUSTOMERS")
      public class CustomerEntity implements Serializable {
      

      - A standard (mandatory) implementation of base entity beans (std.par)
      package app.std.ejb;
      
      @Entity
      public class CustomerEntity extends app.ejb.CustomerEntity {
      

      - Multiple (optional) customized implementation of base entity beans (cust1.par, cust2.par)
      package app.cust1.ejb.;
      
      @Entity
      public class CustomerEntity extends app.ejb.CustomerEntity {
      


      Now, every customized implementation need to access to own datasource (specified in persistence.xml of PARs), using both own and standard entity bean implementations (the correct class is loaded through a custom ClassLoader that use the current context).

      Note that the std.par NOT need to have a reference to a datasource.

      The problem is when I package the application. If I include std.par (with jar-file) in customized PARs, JBoss tell me that I have already registered entity beans:

      AnnotationException: Use of the same entity name twice: CustomerEntity


      Please you can tell me a solution to this problem?