Relation on Unique constraint not picked up by designer

Posts   
 
    
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 08-Apr-2006 10:51:49   

I have two table; ServiceCall and ServiceCallDetail. The ServiceCall table has a Unique constraint on ServiceCallId and a relation with ServiceCallDetail using: ServiceCall.ServiceCallId --1-to-Many--> ServiceCallDetail.ServiceCallId

In the LLBL designer, the relation is NOT picked up and even when I try to create the relation manually, the designer seems NOT to recognize that ServiceCall has a Unique constraint on ServiceCallId

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 08-Apr-2006 11:45:08   

A UC which is used as a 'primary key' isn't a real primary key but a 'surrogate key' and surrogate keys aren't supported for relations.

If you want it to be the PK side of a relation, mark it as PK field in the designer, which is only possible if ServiceCall doesn't have a PK yet.

Frans Bouma | Lead developer LLBLGen Pro
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 08-Apr-2006 12:15:35   

Otis wrote:

A UC which is used as a 'primary key' isn't a real primary key but a 'surrogate key' and surrogate keys aren't supported for relations.

If you want it to be the PK side of a relation, mark it as PK field in the designer, which is only possible if ServiceCall doesn't have a PK yet.

Is this true even if there is a table relation defined between the two tables ServiceCall and ServiceCallDetail

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 08-Apr-2006 12:20:19   

omar wrote:

Otis wrote:

A UC which is used as a 'primary key' isn't a real primary key but a 'surrogate key' and surrogate keys aren't supported for relations.

If you want it to be the PK side of a relation, mark it as PK field in the designer, which is only possible if ServiceCall doesn't have a PK yet.

Is this true even if there is a table relation defined between the two tables ServiceCall and ServiceCallDetail

You mean an FK constraint? An FK constraint which has a UC as PK side is ignored.

Frans Bouma | Lead developer LLBLGen Pro
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 08-Apr-2006 12:35:48   

Otis wrote:

You mean an FK constraint? An FK constraint which has a UC as PK side is ignored.

Yes, thats what I mean. Ok, I have to re-think my desgin confused

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 08-Apr-2006 13:45:03   

Yes, I think the FK is still valuable in the db, but if you want to define a relation between the two tables, you already have that relation defined via the FK on the PK of servicecall.

Frans Bouma | Lead developer LLBLGen Pro