File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Getting same record in query." Watch "Getting same record in query." New topic
Author

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.


Regards,
Naresh Waswani


Naresh Waswani
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300

Hi,
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.