[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Additional field in SELECT of native query changes result.

jsmanger do-not-reply at jboss.com
Wed May 28 07:13:04 EDT 2008


Hello, 

I am using JBOSS 4.2 with a MySql database. I am running a native query through the entity manager (the query is messy but I will post if anybody wants to see all of it). Running the query through the MySQL query browser produces the expected results. However, when running it with the entity manager, adding a field into the select clause changes the result. For example, 

SELECT loan.id, account1.balance
// rest of nasty query

loan.id account1.balance
...
177 456.229 (correct result)
...

Select loan.id, account2.balance, account1.balance

loan.id account2.balance account1.balance
...
177 123.44 123.44 (correct result for account 2, but not for account 1)
...

The queries don't differ in anything except the select statement, and it seems that the wrong values are somehow being overwritten. Has anybody seen something like this before or can you offer some suggestions? Thanks for your help.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153914#4153914

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153914



More information about the jboss-user mailing list