Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange behaviour of Native Query

 
Ankit Garg
Sheriff
Posts: 9509
22
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.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic