5 Replies Latest reply on Mar 28, 2007 1:32 PM by grdzeli_kaci

    InheritanceType JOINED stategy problem

      hi all,
      i have 3 table into database
      Root Table : PAYMENT_METHOD_DATA
      Child Table : BANK_TRNSF_METHOD_INFO
      Child Table : SCRATCH_METHOD_INFO

      in java i have inheritance joined strategy, then root class loojks like this :

      @Entity()
      @Table(name = "PAYMENT_METHOD_DATA", schema = "CCARE")
      @Inheritance(strategy = InheritanceType.JOINED)
      @DiscriminatorColumn(name = "METHOD_DATA_TYPE", discriminatorType = DiscriminatorType.STRING)
      @DiscriminatorValue("Base_MethodData")
      public abstract class PaymentMethodData implements Serializable {
      }
      


      then fiers child looks like :

      @Entity()
      @Table(name = "BANK_TRNSF_METHOD_INFO", schema = "CCARE")
      @DiscriminatorValue("BankTransfer_MethodData")
      public class BankTrnsfMethodInfo extends PaymentMethodData implements
       Serializable {
      }
      

      second child :
      @Entity()
      @Table(name = "SCRATCH_METHOD_INFO", schema = "CCARE")
      @DiscriminatorValue("Scratch_methodData")
      public class ScratchMethodInfo extends PaymentMethodData implements
       Serializable {
      }
      


      when i persist BankTrnsfMethodInfo entity object,
      automatically persisted also PaymentMethodData, but into PAYMENT_METHOD_DATA column METHOD_DATA_TYPE value is NULL. i don't understand what heppened

      can anybody help me ?

      Regards,
      Paata.


        • 1. Re: InheritanceType JOINED stategy problem
          rajeshv7

          I think you have mixed up the 'SINGLE_TABLE' and 'JOINED' Inheritance strategies. The Discriminator's are specified only in the 'SINGLE_TABLE' strategy. And in the 'Joined' since all the subclasses have their own tables there is no need for a discriminator column.

          • 2. Re: InheritanceType JOINED stategy problem

             

            "rajeshv7" wrote:
            I think you have mixed up the 'SINGLE_TABLE' and 'JOINED' Inheritance strategies. The Discriminator's are specified only in the 'SINGLE_TABLE' strategy. And in the 'Joined' since all the subclasses have their own tables there is no need for a discriminator column.


            you are not right!

            The Discriminator's are not specified only in the 'SINGLE_TABLE' strategy. it is possible to use into join strategy.

            i have book "Pro EJB3 Java Persistence API" (Mike Keith and Merrick Schincariol)
            http://www.amazon.com/Pro-EJB-Java-Persistence-API/dp/1590596455

            on page 249 is defined joined strategy and tehere is data model in example Employee, FullTimeEmployee,PartTimeEmployee and ContractEmployee using Joined Strategy.


            find out here Example 1-74
            http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html


            Is There any idea ?

            I can't resolve this problem




            • 3. Re: InheritanceType JOINED stategy problem

              is anybody use this strategy ?
              i can't resolve this problem yet :(

              • 4. Re: InheritanceType JOINED stategy problem

                i can't resolve this problem yet, could anybody help me ?

                • 5. Re: InheritanceType JOINED stategy problem

                  anybody knows where is documentations about it ?