Table inheritance and history preserving

Posts   
 
    
!mpact
User
Posts: 2
Joined: 16-Dec-2005
# Posted on: 16-Dec-2005 09:55:40   

I like LLBLGen very much, but I ran into the following problem. I am dealing with transactions and stuff and I trying to explain the problem in a simple example:

Let's say you have and AdressToPerson Table which has the following columns:

Address_Seq (PK) Person_id some_other_ column

and another table which is actually holding the data called AddressData:

Address_Seq (FK. PK) Last_mod_date(PK) ValidFrom ValidTo Street City Region, ...

there is a 1:m connection between AddressToPerson and AddressData. My problem now, how can I use table inheritance (tablePerEntity-Style) in order to create a table that has the latest address entry and the person_id etc. If I am correct LLBLGen only supports this if there is an 1:1 relationship between the tables. But I cannot do this because I need the changing information of the addresses. Any help and ideas are appreciated.

!mpact
User
Posts: 2
Joined: 16-Dec-2005
# Posted on: 16-Dec-2005 09:57:18   

Sorry I forgot to mention that I am using the adapter template model...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 16-Dec-2005 13:04:17   

I dont think you should use inheritance for this: you should use inheritance to specify attributes and relations on derived types more easily, but not a view on the data, as teh last address is (it's actually a view on the whole address space and it has 1 row).

WHen fetching the address for the person, use the FetchEntityCollection method which accepts a limit, and specify 1 and a sortclause, and perhaps create a utility method for this. It's IMHO better to do it that way than to create a subtype for this which actually isn't a subtype, but just a view on the complete data.

Frans Bouma | Lead developer LLBLGen Pro