Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Table inheritance and relationship issue
 

Pages: 1
Bugs & Issues
Table inheritance and relationship issue
Page:1/1 

  Print all messages in this thread  
Poster Message
Rosacek
User



Location:
CZ
Joined on:
18-Mar-2012 18:02:44
Posted:
133 posts
# Posted on: 17-Oct-2015 23:41:04. Goto attachments  
LLBL 4.2, Pro runtime Framework

Hi, I found following problem.

I have table PARTY
and inherited table PERSON

Then I have table PARTYROLE
and inherited table WORKER


PARTY to PARTYROLE is 1:N

In LLBL designer I cannot see relationship from PersonEntity to WorkerEntity
I can see just relationship to PartyRoleEntity.

The background
When I want to load all Persons that are Workers, I would do in MSSQL someting like:
Select * From Person JOIN Party ...JOIN PartyRole ...JOIN Worker...

In code I would do:
Code:
filter.Relations.Add(EntityClasses.PersonEntity.Relations.WorkerEntityUsingPartyId)
adapter.FetchEntityCollection(ecPersons, filter)

but this way is not possible

I can do just:
Code:
filter.Relations.Add(EntityClasses.PersonEntity.Relations.PartyRoleEntityUsingPartyId)


but I cannot continue by
Code:
filter.Relations.Add(EntityClasses.PartyRoleEntity.Relations.WorkerEntityUsingPartyRoleId)

See DB BAK and LLBL project attached
  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8088 posts
# Posted on: 19-Oct-2015 07:21:59.  
You can just add the relations that don't belong to inheritance and then add a subtype filter. See this documentation link for more info.

David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Rosacek
User



Location:
CZ
Joined on:
18-Mar-2012 18:02:44
Posted:
133 posts
# Posted on: 19-Oct-2015 14:10:27.  
Just to make it clear, Worker is not subtype of Person. It is role of Person

If i use just do

Code:
Dim filter As New RelationPredicateBucket()
filter.PredicateExpression.Add(EntityClasses.WorkerEntity.GetEntityTypeFilter())adapter.FetchEntityCollection(ecPersons, filter)


then the JOIN is: Person To Party WHERE Worker.WorkerID IS NOT NULL
this is incomplete as missing join to PartyRole and then PartyRole To Worker

I tried this:
Code:
Dim filter As New RelationPredicateBucket()
filter.Relations.Add(EntityClasses.WorkerEntity.Relations.PartyEntityUsingPartyId)
adapter.FetchEntityCollection(ecPersons, filter)


and looks it works fine. I get all Person having Worker role
JOIN IS
Worker To PartyRole and PartyPole To Party and Party To Person

I hope this is correct attitude.
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 19-Oct-2015 19:16:45.  
Quote:

Dim filter As New RelationPredicateBucket()
filter.Relations.Add(EntityClasses.WorkerEntity.Relations.PartyEntityUsingPartyId)
adapter.FetchEntityCollection(ecPersons, filter)


and looks it works fine. I get all Person having Worker role
JOIN IS
Worker To PartyRole and PartyPole To Party and Party To Person

I hope this is correct attitude.

It is correct as you are fetching Persons.


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.