Identifying fields on tables without PK

Posts   
 
    
mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 17-Jan-2012 10:48:44   

I have a child table that doesn't have a suitable identifying field(s) and designer is complaining. So, what am I supposed to do? Modifying table is out of the question. What effect has an identifying field actually - does it generate any code at all?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 17-Jan-2012 11:59:30   

How are you going to update or delete from that table if you don't have an Identifying field?

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 17-Jan-2012 12:26:06   

Walaa wrote:

How are you going to update or delete from that table if you don't have an Identifying field?

Probably I won't have to. But if I have to I guess all field comparison will be the way (in this case I guess I'd select all fields as identity field?).

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Jan-2012 22:16:19   

So, you just want it for read-only purposes. You can map that target table into a TypedView, which doesn't require IdentifyingFields.

The IdentifyingFields are important to do inserts, updates and refetches of single entities. If you want it into a Entity object you must define an IdentifyingField (some non-optional field) in the model and set IdentifyingFieldsFollowDBPrimaryKeyConstraints to false at Project properties.

Related discussion: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=18380&StartAtMessage=0&#103011

David Elizondo | LLBLGen Support Team
mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 18-Jan-2012 08:25:05   

daelmo wrote:

So, you just want it for read-only purposes. You can map that target table into a TypedView, which doesn't require IdentifyingFields.

The IdentifyingFields are important to do inserts, updates and refetches of single entities. If you want it into a Entity object you must define an IdentifyingField (some non-optional field) in the model and set IdentifyingFieldsFollowDBPrimaryKeyConstraints to false at Project properties.

Related discussion: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=18380&StartAtMessage=0&#103011

Right, makes sense. Thanks.