Sorry by bad,
On further investigation the problem gets resolved when the fetch is changed from fetch="select" to fetch="join" and the queries get generated as expected
Here is the Stack Trace
Code:
Hibernate: select schedule0_.SCHED_ID as SCHED1_, schedule0_.version as version11_, schedule0_.CREATION_DATE as CREATION3_11_, schedule0_.MODIFIED_DATE as MODIFIED4_11_, schedule0_.ACTIVE_FLAG as ACTIVE5_11_, schedule0_.SCHED_NAME as SCHED6_11_, schedule0_.DESCRIPTION as DESCRIPT7_11_, schedule0_.sched_type as sched8_11_ from RESD_SCHED schedule0_
Hibernate: select rules0_.SCHED_ID as SCHED7___, rules0_.RULE_ID as RULE1___, rules0_.RULE_ID as RULE1_2_, rules0_.version as version8_2_, rules0_.CREATION_DATE as CREATION4_8_2_, rules0_.MODIFIED_DATE as MODIFIED5_8_2_, rules0_.ACTIVE_FLAG as ACTIVE6_8_2_, rules0_.SCHED_ID as SCHED7_8_2_, rules0_1_.NO_OF_DAYS as NO2_9_2_, rules0_1_.UNITS as UNITS9_2_, rules0_.RULE_TYPE as RULE2_2_, residualsl1_.LOOKUP_CODE_ID as LOOKUP1_0_, residualsl1_.version as version21_0_, residualsl1_.LOOKUP_CODE as LOOKUP3_21_0_, residualsl1_.lookup_type as lookup4_21_0_, residualsl1_.sort_order as sort5_21_0_, residualsl1_.lookup_description as lookup6_21_0_, residualsl1_.active_flag as active7_21_0_, residualsl1_.creation_date as creation8_21_0_, residualsl1_.modified_date as modified9_21_0_, residualsl1_.DISPLAYED_VALUE as DISPLAYED10_21_0_, lookuptype2_.lookup_type as lookup1_1_, lookuptype2_.version as version20_1_, lookuptype2_.ACTIVE_FLAG as ACTIVE3_20_1_, lookuptype2_.creation_date as creation4_20_1_, lookuptype2_.modified_date as modified5_20_1_, lookuptype2_.LOOKUP_DESCRIPTION as LOOKUP6_20_1_, lookuptype2_.DISPLAY_NAME as DISPLAY7_20_1_ from RESD_RULE rules0_ left outer join RESD_TIME_UNIT rules0_1_ on rules0_.RULE_ID=rules0_1_.TIME_UNIT_ID left outer join RESD_LOOKUP_CODE residualsl1_ on rules0_2_.CAST_CON_TYPE_CODE=residualsl1_.LOOKUP_CODE_ID left outer join RESD_LOOKUP_TYPE lookuptype2_ on residualsl1_.lookup_type=lookuptype2_.lookup_type where rules0_.SCHED_ID=?
com.fox.residuals.exception.DataStoreException: org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.fox.residuals.model.system.schedule.Schedule.rules#3023]
at com.fox.residuals.dao.hibernate.ContractDAOHibernate.deleteSchedule(ContractDAOHibernate.java:1444)
at com.fox.residuals.dao.hibernate.ContractDAOHibernateFUnit.testDeleteSchedule(ContractDAOHibernateFUnit.java:741)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)Residuals WARN [main] JDBCExceptionReporter.logExceptions(71) | SQL Error: 904, SQLState: 42000
Residuals ERROR [main] JDBCExceptionReporter.logExceptions(72) | ORA-00904: "RULES0_2_"."CAST_CON_TYPE_CODE": invalid identifier
Residuals DEBUG [main] ContractDAOHibernate.deleteSchedule(1441) | org.hibernate.exception.SQLGrammarException: could not initialize a collection: [com.fox.residuals.model.system.schedule.Schedule.rules#3023]
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
[/code]