Daniel --

The Query interface defines a "setDistinct(boolean)" method.  Set this to
true and you should see better results.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

-----Original Message-----
From: Daniel Perry [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 9:41 AM
To: OJB Users List
Subject: join and retrieve single object?


I want to query the database and retrieve a specific manager, and only their
employees whoose training (boolean) matches the requirement.  Instead of
getting one manager with the x (out of y) employees, i get x managers.
My code is: (getObjectsByType) is just a query by criteria shortcut.

Criteria crit = new Criteria();
crit.addEqualTo("id", new Integer(managerId));
crit.addEqualTo("employees.training", new Boolean(training));
List mgrs = getObjectsByType(Manager.class.getName(), crit);
System.out.println("MANAGERS FOUND: " + Integer.toString(mgrs.size()));

Is there any way to get just the one manager?

Daniel.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to