Many to Many relations

Posts   
 
    
ZibiBur
User
Posts: 2
Joined: 06-Feb-2012
# Posted on: 06-Feb-2012 21:39:17   

Hi,

I have two types A and B which are in relation many to many and I wont to get all related entities of type B from single entity of type A, How can I do this? Both types are inherited from EntityBase2.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Feb-2012 05:35:53   

So, you have EntityA, EntityB, and an intermediate m:n entity EntityAB that relates the two of them. So should add a m:n relation in the Designer. I assume you are using v3.x. Here is how to add Many to Many relations.

Then you will have additional navigators: AEntity.Bs and BEntity.As. You have to use PrefetchPaths at runtime to fill such navigators.

David Elizondo | LLBLGen Support Team
ZibiBur
User
Posts: 2
Joined: 06-Feb-2012
# Posted on: 07-Feb-2012 08:58:57   

the m:n navigartor will not solve the issue for me, what I am interested in is to list all m:n relations, and thats it if the m:n relation navigator in the LLBGen was not read-only then it would solve the case but if not then it is useless for my app

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 07-Feb-2012 09:04:18   

You said:

what I am interested in is to list all m:n relations, and thats it

Then you said:

if the m:n relation navigator in the LLBGen was not read-only then it would solve the case but if not then it is useless for my app

I'm not sure what do you need exactly.

You can fetch the Bs by calling a normal fetch with the appropriate filter. e.g.

SELECT * FROM B
WHERE B.ID IN (SELECT BID FROM AB WHERE AID = xx)