Is there any example how to use SQL alias whit Hibernate, the problem is when retrieving result.
I have two columns with same name and Hibernate doesn't right value.
Code:
String sql = "SELECT uporabniki.id, status.vrednost, host.vrednost "
+ "FROM uporabniki "
+ "LEFT JOIN sif_upostat AS status ON status.id=uporabniki.status "
+ "LEFT JOIN cluster_hosts AS host ON host.id=uporabniki.chost_id "
+ "WHERE uporabniki.id=10"
Query arisQuery = emAris.createNativeQuery(sql);
List arisResult = arisQuery.getResultList();
// retrive data
for(int i = 0; i < arisResult.size(); i++){
Object[] rs = (Object[])arisResult.get(i);
if(rs.length == 3){
String status = rs[2];
String host = rs[3];
Bug: this values are the same
}
So is Hibernate have problems retrieving column's whith same name?
Is there the simple way to solve this, without mapping's?
Regards, Tomaz