I am using Hibernate 3.5.1(Oracle10gDialect) and query with createAlias & Restrictions function as below HQL, it would generate wrong SQL. In the SQL, you can see ut2_.ID that is wrong SQL alias "ut2" and also add a colon before 'from' text "UPDATE12_22_0_, from"
Is my HQL wrong or Hibernate bug?
HQL ============================================= session = getSessionFactory().openSession(); coll = (Collection) session.createCriteria(Function.class). createAlias("application", "app"). add( Restrictions.eq("app.appId", appId) ). createAlias("userTypes", "ut"). add( Restrictions.eq("ut.id", userTypeId) ).list();
Generated SQL ============= select this_.ID as ID17_1_, this_.VERSION_NO as VERSION2_17_1_, this_.FUNC_DESC as FUNC3_17_1_, this_.APP_ID as APP4_17_1_, this_.CREATE_DATE as CREATE5_17_1_, this_.CREATE_USER as CREATE6_17_1_, this_.UPDATE_DATE as UPDATE7_17_1_, this_.UPDATE_USER as UPDATE8_17_1_, app1_.APP_ID as APP1_22_0_, app1_.VERSION_NO as VERSION2_22_0_, app1_.APP_DESC as APP3_22_0_, app1_.APP_NAME as APP4_22_0_, app1_.EXEC_FILENAME as EXEC5_22_0_, app1_.EXEC_PATH as EXEC6_22_0_, app1_.IMAGE_FILENAME as IMAGE7_22_0_, app1_.SYSTEM_VER as SYSTEM8_22_0_, app1_.CREATE_DATE as CREATE9_22_0_, app1_.CREATE_USER as CREATE10_22_0_, app1_.UPDATE_DATE as UPDATE11_22_0_, app1_.UPDATE_USER as UPDATE12_22_0_, from SCS_FUNCTION this_ inner join SCS_APPLICATION app1_ on this_.APP_ID=app1_.APP_ID inner join SCS_FUNCTION_USER_TYPE usertypes5_ on this_.ID=usertypes5_.FUNC_ID where app1_.APP_ID=? and ut2_.ID=?
|