Hello,
I have following table with test data: * # ## id, created_date, created_by, updated_date, updated_by, workstation_state, permanent_login_id, user_id, workstation_id '3773', '2019-07-01 16:21:58', 'test', '2019-07-01 16:21:59', 'test', 'OFF', '19', '14', '26' '3774', '2019-07-01 16:22:22', 'test', '2019-07-01 16:22:23', 'test', 'ON', '19', '14', '26'*
When I execute this HQL query *select lw from LoggedInWorkstation lw where lw.user.id=14 group by lw.workstation.id order by lw.workstation.id desc* I got this: '3773', '2019-07-01 16:21:58', 'test', '2019-07-01 16:21:59', 'test', 'OFF', '19', '14', '26' ......
but I'm expecting this '3774', '2019-07-01 16:22:22', 'test', '2019-07-01 16:22:23', 'test', 'ON', '19', '14', '26' ........
when I execute a plain sql query inside a mysql console *SELECT * FROM logged_in_workstation as lw WHERE lw.user_id=14 GROUP BY lw.workstation_id ORDER BY lw.workstation_id DESC* I got the expected result.
Why is it different when I'm using hibernate (HQL)? |
|