wood burning stoves*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Strange behaviour of Native Query" Watch "Strange behaviour of Native Query" New topic
Author

Strange behaviour of Native Query

Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange behaviour of Native Query
 
Similar Threads
@ColumnResult
Doubt about native query
No Dialect mapping for JDBC type: -9
EJB3.0 persistence API
Mapping to an xml typed column (PostgreSQL) on an EJB3 entity in JBoss 5.1