query possible

Posts   
 
    
Posts: 20
Joined: 23-Feb-2005
# Posted on: 23-Feb-2005 21:08:36   

I have two tables

table A A_ID --> primary key LIST_ID B_ID_FK --> Foriegn key to table b

table B B_ID --> primary key Description

SO I have two entity class AEntity BEntity

So what I want is a collection of BEntity values that in table A have LIST_ID value of 1. But there is not a direct relationship between table b and table a. (The relationship is between A and B)

IS there an easy way to do this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 24-Feb-2005 11:03:46   

richardcherry wrote:

I have two tables

table A A_ID --> primary key LIST_ID B_ID_FK --> Foriegn key to table b

table B B_ID --> primary key Description

SO I have two entity class AEntity BEntity

So what I want is a collection of BEntity values that in table A have LIST_ID value of 1. But there is not a direct relationship between table b and table a. (The relationship is between A and B)

The designer will pick up the foreign key between A -> B, and will add an m:1 relation between A and B and an 1:n relation between B and A.

You can thus use the BEntity.Relations.AEntityUsingB_ID_FK relation to create the join between A and B and filter on A.B_ID_FK=1.

You're using adapter or selfservicing? (so I can write up an example for you)

Frans Bouma | Lead developer LLBLGen Pro
Posts: 20
Joined: 23-Feb-2005
# Posted on: 24-Feb-2005 22:22:29   

Otis wrote:

richardcherry wrote:

I have two tables

table A A_ID --> primary key LIST_ID B_ID_FK --> Foriegn key to table b

table B B_ID --> primary key Description

SO I have two entity class AEntity BEntity

So what I want is a collection of BEntity values that in table A have LIST_ID value of 1. But there is not a direct relationship between table b and table a. (The relationship is between A and B)

The designer will pick up the foreign key between A -> B, and will add an m:1 relation between A and B and an 1:n relation between B and A.

You can thus use the BEntity.Relations.AEntityUsingB_ID_FK relation to create the join between A and B and filter on A.B_ID_FK=1.

You're using adapter or selfservicing? (so I can write up an example for you)

Thanks you for your quick response. I am using selfservicing.

I did not know that 1:N relationship between b and A was created.

Thank for you offer of an example. With the knownledge of the 1:N relationship being created I solved my problem.

I will say, that I originaly was looking for a solution for JDO in .net when I picked LLBLGen pro. After using LLBLGen for a while, I never want to go back to JDO.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 24-Feb-2005 23:17:06   

richardcherry wrote:

Otis wrote:

richardcherry wrote:

I have two tables

table A A_ID --> primary key LIST_ID B_ID_FK --> Foriegn key to table b

table B B_ID --> primary key Description

SO I have two entity class AEntity BEntity

So what I want is a collection of BEntity values that in table A have LIST_ID value of 1. But there is not a direct relationship between table b and table a. (The relationship is between A and B)

The designer will pick up the foreign key between A -> B, and will add an m:1 relation between A and B and an 1:n relation between B and A.

You can thus use the BEntity.Relations.AEntityUsingB_ID_FK relation to create the join between A and B and filter on A.B_ID_FK=1.

You're using adapter or selfservicing? (so I can write up an example for you)

Thanks you for your quick response. I am using selfservicing.

I did not know that 1:N relationship between b and A was created.

Thank for you offer of an example. With the knownledge of the 1:N relationship being created I solved my problem.

great! smile

I will say, that I originaly was looking for a solution for JDO in .net when I picked LLBLGen pro. After using LLBLGen for a while, I never want to go back to JDO.

simple_smile Yeah, it sounds nice on paper, but it is a lot of work you witha pure O/R mapper style development while with LLBLGen Pro the generator gets you a headstart which saves you a lot of time.

Frans Bouma | Lead developer LLBLGen Pro