my dog learned polymorphism
The moose likes Object Relational Mapping and the fly likes Strange behaviour of Native 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 "Strange behaviour of Native Query" Watch "Strange behaviour of Native Query" New topic

Strange behaviour of Native Query

Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

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.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: Strange behaviour of Native Query
It's not a secret anymore!