Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Strange behaviour of Native Query

Ankit Garg
Posts: 9597
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I am using a complicated native query. Because of some sort of performance enhancements, EJB is giving me wrong result in that. First let me explain what the query looks like (I'm giving a simplified version of my query. I had to use native query because I had to group my results month wise)

Now I don't know why, it returns the same value for both the columns. I'm sure this is some sort of short cut used by JPA to use a cached version of the value for the second column as both the columns have the same. Although I've solved it by usin SqlResultSetMapping in Payment entity and modifying the query

Still if there is a way to correct this, then please tell me.

Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!