• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Result Set Different then SQL Result Set

 
Ankit V Agrawal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm running a query to fetch some 100 records from the database. The Database is SQL Server 2008.
When I'm running the query from the MS SQL Management Studio it is returning the correct result set.
But when I'm running it thru hibernate the result set is different.

I have tried to print the query and the query is being printed exactly as what I want it to be. Still the result set is different when I iterate thru the list and print it.

Also I have checked that the my code is connecting to the correct data base.

Any idea if hibernate does some kind of caching issues ? Has anybody faced this kind of problem before ?
Any help would be appreciated.

Regards,
Ank
 
Ankit V Agrawal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to test the query thru JDBC and that is also returning the right result. So it has got to do something with hibernate.

2 Records fetched
Transaction ID From Hibernate :: 3062
Transaction ID From Hibernate :: 3062

Transaction ID From JDBC :: 3062
Transaction ID From JDBC :: 3063

Any ideas what is going wrong ?
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But when I'm running it thru hibernate the result set is different.

In what way(s) this is different form the normal behavior?
 
Ankit V Agrawal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hibernate was returning the same object 2 times. I found the error, the unique key was wrongly defined!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic