This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 9291

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
Similar Threads
No Dialect mapping for JDBC type: -9
Doubt about native query
Mapping to an xml typed column (PostgreSQL) on an EJB3 entity in JBoss 5.1
EJB3.0 persistence API