Creating a new Entity and assigning its PK to related collection(s)

Posts   
 
    
zmian
User
Posts: 14
Joined: 19-Oct-2005
# Posted on: 19-Oct-2005 16:39:32   

Hello, I am using an Oracle db with Tables that have Sequences for its PK, which are assigned through an insert trigger.

So, for example, Employee and Orders are linked by EmployeeId (PK on Employee, FK on Orders). Order's PK is EmployeeOrderId, which is also assigned by the insert trigger.

I need to create a new Employee Entity (so at this time it does not have a EmployeeId assigned) and then add a few Orders, before finally saving it. However, I can't figure out how to assign/sync the EmployeeId from the Employee to each of the objects in the Orders collection. I'm using the adapter model.

Thanks.

zmian
User
Posts: 14
Joined: 19-Oct-2005
# Posted on: 19-Oct-2005 21:42:13   

Oh, MAN! I wasted a whole day, but in the end it turned out be very easy. I don't know what I was doing wrong (changed the code so many times, forgot what the fix was), but the following thread really helped.

http://llblgen.com/tinyforum/Messages.aspx?ThreadID=1820

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 20-Oct-2005 09:51:06   

Also have a look at 'Generated code - Application configuration through .config files', in the documentation, where you can set a config setting to tell llblgen that triggers are used for sequences.

Frans Bouma | Lead developer LLBLGen Pro