Hey guys,
I am trying to cache hierarchy query...
Is this following possible in hibernate (more specific in hibernate 2):
Code:
String sql = "select {a.*} from table_1 a"
+ " where a.VENDOR_ID IN (select v.vendor_id from table_2 v start with v.vendor_id = 2 connect by prior v.vendor_id=v.parent_id)";
Query query = session.createSQLQuery(sql,new String[] { "a", "v" },new Class[] {Table1.class, Table2.class});
I am only trying to cache the hierarchy part.
This works fine if i only use the agreement as an alias and the class.
Code:
String sql = "select {a.*} from table_1 a"
+ " where a.VENDOR_ID IN (select v.vendor_id from table_2 v start with v.vendor_id = 2 connect by prior v.vendor_id=v.parent_id)";
Query query = session.createSQLQuery(sql,new String[] { "a"},new Class[] {Table1.class);
but then the results are not cached......so i am trying to make the hierarchy part return an object.
caching works fine when i use the following query by it self:
Code:
select v.vendor_id from table_2 v start with v.vendor_id = 2 connect by prior v.vendor_id=v.parent_id
Thank you