• 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

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.

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 ]
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic