TargetPerEntityHierarchy Inheritance

Posts   
 
    
Faisal
User
Posts: 3
Joined: 09-May-2006
# Posted on: 09-May-2006 09:42:19   

Hi, The 'CompanyCar' example is a very simple example of TargetPerEntityHierarchy inheritance, where all the columns of table are mapped to every involved object. There can be a situation where every derived object maps to different columns of the same table. I doubt, LLbLgen doesn't support this situation as it only asks for the descriminator column and not for other possible columns that no other derived object should have.

For example, we have a 'Payment' table that has columns paymentid amount bankintrest bankname bankbranch paymenttype.

Now I want three subtypes of object Payment { PaymentID, Amount} 1. CashPayment 2. CreditCardPayment {BankIntrest} 3. ChequePayment {BankName, BankBanch}

How would this be implemented?

Thanks Faisal

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 09-May-2006 09:51:35   

1- All the fields that you want to have on the subTypes should allow null. 2- Go to the SubEntity Properties in the LLBLGen Pro designer. 3- Open the EntityFields Tab. 4- Right above the fields list you will find Unmapped target fields subTab. Use it to map the fields you want to different sub entities.

Faisal
User
Posts: 3
Joined: 09-May-2006
# Posted on: 09-May-2006 13:20:41   

Thanks Walaa..!! But before I start, may I know how the CRUD is being performed? Are you guyz doing CRUD operations in one db trip or as many as objects.

Thanks again.. Faisal

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 09-May-2006 14:29:43   

Faisal, You are always welcomed.

But before I start, may I know how the CRUD is being performed? Are you guyz doing CRUD operations in one db trip or as many as objects.

The following thread is rather old but it may give you a clear view of what's going on. http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=1691

Faisal
User
Posts: 3
Joined: 09-May-2006
# Posted on: 09-May-2006 15:32:26   

Sorry Walaa but this is not what i asked. I was talking in context to TargetPerEntityHierarchy Inheritance. How is CRUD performed in case of TargetPerEntityHierarchy Inheritance?

I hope my question is clear this time.

Thanks Faisal

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 10-May-2006 20:35:03   

Faisal wrote:

Hi, The 'CompanyCar' example is a very simple example of TargetPerEntityHierarchy inheritance, where all the columns of table are mapped to every involved object.

No, you have the HasDrawingHook, which isn't added to the sportscar and you have the IsCabrio field which isn't part of the familycar type.

There can be a situation where every derived object maps to different columns of the same table. I doubt, LLbLgen doesn't support this situation as it only asks for the descriminator column and not for other possible columns that no other derived object should have.

For example, we have a 'Payment' table that has columns paymentid amount bankintrest bankname bankbranch paymenttype.

Now I want three subtypes of object Payment { PaymentID, Amount} 1. CashPayment 2. CreditCardPayment {BankIntrest} 3. ChequePayment {BankName, BankBanch}

How would this be implemented?

Thanks Faisal

In all cases the discriminator column has to be there. Otherwise how to determine which entity type the data represents? So paymenttype has to be part of every type. The rest is free for you to choose. (except the pk of course.) So I'm a little puzzled what the problem is.

Frans Bouma | Lead developer LLBLGen Pro