aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate Query by Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Query by Example" Watch "Hibernate Query by Example" New topic
Author

Hibernate Query by Example

yusuf nazir
Greenhorn

Joined: May 13, 2009
Posts: 12
Hi All,
I'm stuck with a problem.
I want to use Hibernate Query by Example but am getting a problem with my result.
I'm querying over two tables, a parent-child situation.

I have a class called CheckSum and a class called Record.
CheckSum has a set of Record.
When i execute the query, the resultset of CheckSum is equal to all the resultset of Record.
I'm not getting a parent-child resultset.

Thus is CheckSum has {chk01,chk02,chk03}
chk01 has {rec01,rec02}
chk02 has {rec03,rec04,rec05}
chk03 has {rec06,rec07,rec08}

if I query chk02 and all his record I get a list of 3 CheckSum and in all those 3 the same amount of record is repeated.

How does query by example work with joins???

thanks in advance.

Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Does Record have a primary key?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
yusuf nazir
Greenhorn

Joined: May 13, 2009
Posts: 12
Hi Paul,

Record does have a primary key and so does checksum

This is the record class:



this is the hibernate record mapping:


This is the checksum class:


this is the checksum hibernate mapping:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Query by Example
 
Similar Threads
hibernate child set didn't deleting the objects when updating
whats this mean
Assigning object references of different types
Hibernate performance issues using huge databases
Static methods and inheritance.