wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Getting same record in query. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Getting same record in query." Watch "Getting same record in query." New topic

Getting same record in query.

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
Hi List,
When i run the query in oracle prompt its show two different record.But when i try to get the records in the view page its show same records i.e
same rows more than one.

My HBM file:

My POJO Class is

I am calling like this

Pl help me where is the mistake.
Waswani Naresh
Ranch Hand

Joined: May 01, 2008
Posts: 66
The number of records that you are getting from the Query execution via Hibernate and from console are same, the only difference is the values of the row ? Is that correct ?

I did not find definition of clear(); what is the role of this method in the finally block ?

Have you tried wrapping your query execution with in transaction limits ? I know it does not make much sense here because you are getting some records fetched, but please try that once.

Also, could you paste the outcome of the System.out.println statements and the one that you are getting from the console.

Naresh Waswani

Naresh Waswani
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300

Records count is coming same.But rows value repeating.

Hibernate generate the sql like this:

And in sql console the output coming like this

But when i put

Its prints two value Setup and Setup in java console.It should print Setup and Barcode.

I used clear(); to clear the hibernate session.

I agree. Here's the link: http://aspose.com/file-tools
subject: Getting same record in query.
Similar Threads
Not able to find the added record in table.
Hibernate - multiple collection with restrictions mapping problem
hibernate composite key problem
Hibernate Issue