Relation between view and table

Posts   
 
    
Anthony
User
Posts: 155
Joined: 04-Oct-2006
# Posted on: 25-Sep-2013 08:23:41   

llblgen v3, adapter, How do i create a joing between a table and view? It appears the primary key in a view is being ignored or hidden from GUI..when i try to do a normal join..the row in the relation key gris is blank ie cannot select the key to join by

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Sep-2013 09:36:26   

Map entity on view, specify which field(s) are the identifying fields in the entity, then define the relationship. Views don't have PKs so you have to define the PK in the entity mapped onto it.

Frans Bouma | Lead developer LLBLGen Pro
Anthony
User
Posts: 155
Joined: 04-Oct-2006
# Posted on: 25-Sep-2013 10:06:50   

Otis wrote:

Map entity on view, specify which field(s) are the identifying fields in the entity, then define the relationship. Views don't have PKs so you have to define the PK in the entity mapped onto it.

When i try to edit the vw in the model..the primary key is not listed! I can see the key in the catalof explore but whne i reverse engineer..the pk field doesn't come across

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Sep-2013 10:48:25   

Anthony wrote:

Otis wrote:

Map entity on view, specify which field(s) are the identifying fields in the entity, then define the relationship. Views don't have PKs so you have to define the PK in the entity mapped onto it.

When i try to edit the vw in the model..the primary key is not listed! I can see the key in the catalof explore but whne i reverse engineer..the pk field doesn't come across

View meta data doesn't have information about pk fields, so I doubt the view in the catalog explorer has a PK defined. Aren't you looking at a table instead? E.g. the table the view is based on?

Regardless, with views, you should specify the identifying fields on the entity in the entity editor, like I wrote in my previous post, as views don't have PKs so they're obviously not used for the identifying fields in an entity (as there IS no PK information available on a view).

And before you might think I'm wrong, there's no code in the driver either to obtain the information for PK fields for views. wink See for yourself in the driver source code.

Frans Bouma | Lead developer LLBLGen Pro