Please search and use the user forum for such questions... and the doc :-)

Emmanuel Bernard
01.55.21.52.14
Fnac - DSI
Direction France - Nouvelles technologies
67, boulevard du Gal Leclerc
92612 Clichy Cedex



Robb Greathouse wrote:

I can query by example with the following code perfectly; except when the primary key (ID) is the only one set. Then the where clause read "Where 1=1" (1 being the unique ID). When the example object only has the ID set it loads all entries in the table. Is there something else I need to do.
//////////////////////
////////////////////
this.courtCase.setID(caseID);
this.courtCase.setSequence(sequence);
this.courtCase.setYear(year);
this.courtCase.setType(type);
Example example = Example.create(this.courtCase);
example.excludeZeroes();
example.excludeProperty("createdDate");
example.excludeProperty("changedDate");
example.excludeProperty("sealed");
example.excludeProperty("advanceWarningSent");
example.excludeProperty("exceedsMaxNumberOfWarnings");
example.excludeProperty("domesticViolence"); this.courtCase = (CourtCase) session.createCriteria(CourtCase.class)
.add(example) .uniqueResult();
//////////////////////////
//////////////////////////
//////////////////////
If ID is not null; sequence, year and type will be null. If ID is null the other three will not be null. When ID is null and sequence, year and type or set it gets one courtCase (these three constitute the number). But when ID is set and the others are null it loads all entries in the table.
Is there something I need to set.



------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to