1 Reply Latest reply on Mar 10, 2009 1:50 PM by Florence Cousin

    Inheritance

    praveen  vanga Newbie

      can anyone let me know how to implement the Inheritace ? i have employee , payment, credit card, cash, cheque , and payment type . I have one table per each class.


      I am working with seam gen home and query classes , can you please suggest some examples how to implement for entity classes and what are the changes required for Home and Query classes

        • 1. Re: Inheritance
          Florence Cousin Newbie

          Hi,


          I had a similar problem, and I solved it :


          example


          In this example, I implemented the Single_table strategy, then the joined strategy : it is the strategy in which you define all the common attributes on table, and you join it with the child table :
          For example, you would have one table 'payment' with all the common field (payment_id, date...) , one table 'cheque' (payment_id, cheque_number), one table 'credit card' (payment_id, card_number...). And a foreign key from cheque to payment (on the payment_id field), one foreign key from credit_card to payment, etc...


          I do not understand which strategy you want to implement (joined, or table per class ?). But if you want to implement the table per class 1 strategy, I suppose it is not very different...


          1. table per class is when you define one table for each concrete class. In you example, if your program wants to retrieve all the payments, it makes unions to retrieve all information.