Affects Version/s: None
Fix Version/s: None
Environment:Open JPA 1.x, WAS 7.0, Windows 7 64 bit, Java 1.6
I have a native query for a join operation and corresponding entity-resultset defined in the orm.xml as follows,
<named-native-query name="getPaymentById" result-set-mapping="paymentMapping">
<query>SELECT T1., T2. FROM TEMP.PAYMENT T1 LEFT JOIN TEMP.PAYMENT T12 ON T1.Col1 = T2.Col2 WHERE T1.PAYMENT_ID = ?
Where the SQL result for one of the scenario in the above query is, T1 returns records for all the columns and T2 is null for all the columns.
But the way entity mappings returned by the Query class's getResultList() method is T1 and T2 has same instances and same records. i.e., T2 doesnot returns Null value but instead uses the same value as T1.
The java code which returns this result is as follows,
Query createNamedQuery = getEntityManagerDao().getEntityManager().createNamedQuery("getPaymentById");
List<Object> result = (List<Object>)createNamedQuery.getResultList();
Please let me know if i am missing something or it is an JPA issue.
THanks in advance.