Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Criteria on joining fails

 
Ergin Er
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

First of all this is my first post on this forum

I'm working on genereating a criteria that will return a list of data from two joined tables.
The tables involved are:
Domain (pk id, fk ppo_id, name)
Workmate (pk id, fk domain_id, fk ppo_id, name, ...)

So I need a statement like this:


this statement will vary depending on input filters
(domain name, search string)

I'm using criteria to handle this.

It quits when I second create criteria adding workmate to the equasion. I think this might be happening because the pk name and fk name from respective tables are not equal. Is this the case?
If so, how can I add the createria saying it should look at the id as a key to join. Or am I missing something else?
Or should I just use Query to generate the sql?

Any help would be appreciated in this matter.

Update:
This problem was caused by not implementing the tables bi-directionally. I only has a unidirectional refernce saying in workmate it has a fk pointing to domain id. I also needed to make clear to domain table that it has "children" in the workmate table (workmates). With that it now walks through the criteria.
[ September 08, 2005: Message edited by: Ergin Er ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic