Hello.
I am using the following versions:
Hibernate version:2.1.8
Name and version of the database you are using:Postgresql 7.4.7
When I run a query using:
Code:
Query q = session.createQuery(getQueryText(queryLines));
parseQueryArgs(q, passedArgs);
ObjectList result = new HibObjectListImpl(q.list());
I get the correct results though the foreign keys only go four deep through
many-to-one mappings?
It's probably a bad habit but I have a few occasions where there was the following type of scenario:
Code:
SELECT * FROM dept WHERE deptId = 1;
I run this through the query DAO above.
then in the code I do the following.
Code:
dept.getFran().getOrg.getGroup.getName();
but this returns null, not the value 'groupName' from the database.
If I run dept.toString() I get:
Code:
[deptId=1, name=deptName, fran=[franId=2, name=franName, org=[orgId=2, name=orgName, group=[groupId=2, name=null, groupTp=null, groupTpId=0, status=null, statusId=0, startTimestamp=null, lastModified=null], groupId=2], orgId=2], franId=2]]
You can see the foreign keys for the group object a have not been loaded.
I know this is really bad and I like the fact that hibernate only fetches deep into foreign keys but I was wondering if there is a way to toggle this setting and if not why isn't it better documented. I may be searching for the wrong thing but I haven't been able to find any documentation on the number of foreign keys deep hibernate loads for queries.
Is there a way around this ?
Is this behavior well documented ? (I would like to check it before upgrading)
Should I upgrade to hibernate 3.x ?