• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Criteria on joining fails

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic