Custom Relationship on the designer

Posts   
 
    
Posts: 15
Joined: 02-Feb-2008
# Posted on: 19-Mar-2009 21:30:07   

Version: Version 2.6 (Final) Database: Oracle 8i Driver: Oracle 8i/9i/10g Driver (Oracle .Net Provider)

Hi,

Is there a way in the designer can you create a relationship using a non PK and FK columns. The designer is only showing PK fields on the selection. We have few tables on our database that has no PK/FK setup. As application developer, we don't have access to create the proper key on those tables.

And we also have some existing index on the tables that if use it to create relationship, it will be a lot faster

Here's a example scenario

Customer Order CustomerId (PK) OrderId CustomerGroup CustomerId (FK) .. CustomerGroup ...

Customer has index setup on combination CustomerId & CustomerGroup Order also has index setup on combination CustomerId & CustomerGroup

So if we used the both CustomerId and CustomerGroup to create relationship instead of just customerid, query is more faster.

I know our table is not well normalized but this is an old application that where trying to convert without much changes on the database part.

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 20-Mar-2009 05:51:20   

You can make a field be part of the PK: - Select the entity you are interested and right-click "Edit" - Go to (by default) Fields mapped on database fields subtab. - Select the field you want. - Check the "Is part of primary key" checkbox. - Ready! - Then you can go to Relations subtab and create the appropiate relations.

The only requirement is that the field should be "NOT NULL" at database.

David Elizondo | LLBLGen Support Team
Posts: 15
Joined: 02-Feb-2008
# Posted on: 20-Mar-2009 18:16:16   

** "Is part of primary key"** is disabled on the designer even if the field is set to not nullable.

I attached the screen shot of the designer.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 20-Mar-2009 20:02:29   

I see now. Sorry, I didn't notice that in your post above. The checkbox is enabled if the target of the entity (the table) doesn't have a PK AND the field itself isn't nullable. As you have a PK, you can't do that.

David Elizondo | LLBLGen Support Team