Convert SuperType to SubType

Posts   
 
    
luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 08-May-2008 17:53:04   

Is there a recommended way for converting a superType entity to a subType Entity? For example, I have Person as superType and Employee as subType:

Person Employee

A person (superType) joins our company and becomes an employee (subType). My understanding is that I can't simply cast and save. I could copy the person entity to a new employee entity and destroy the old entity, but then I lose the unique Id for that entity.

Is there a recommended way of doing this so I can keep the unique entity Id from superType to subType?

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 09-May-2008 08:46:54   

By design you can't switch types in an inheritance hierarchy.

So if you want to hack it, there is no onther way than to copy and destyroy, and loose the old ID. Otherwise you might use non-LBLGen code to insert the subType.

luciusism
User
Posts: 119
Joined: 02-Jun-2007
# Posted on: 09-May-2008 19:32:25   

Thanks Walaa, I appreciate the prompt response. Can I change this into a feature request? I understand the problem with inheritance this might cause, but at the same time I believe that the scenario mentioned is a real-world example where it would be very useful.

Thanks again for all your help!

Findev
User
Posts: 103
Joined: 08-Dec-2014
# Posted on: 09-Oct-2015 15:32:37   

Yeah, also had a similar use case. Needed to convert User to CompanyUser and vice versa (Target per entity hierarchy). As a workaround attempt I created a separate new entity in the Designer that was mapped to CompanyUsers table, but Designer's validation indicated that two entities can't be mapped to the same target. So I reverted and created two stored procedures instead to do the conversion.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Oct-2015 08:27:26   

Hi Findev,

This request had been asked before. LLBLGen won't include such functionality for the data integrity sake. If you have time you can read the following thread where this is discussed: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14835

P.S.: Next time please don't re-open old threads, open a new one instead wink http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7722

David Elizondo | LLBLGen Support Team