My app does a lot of work with "owned" objects, so many classes use many-to-one mappings to a single Owner class. In all my queries (HQL and plain old load/get) the joins are working great. However when I have two levels of indirection to an owned object, its owner isn't fully loaded: the id is populated, but all other fields are left at their defaults.
So if I load owned object A, owner X, and A has a many-to-one/unique mapping to owned object B, owner X, then B.getOwner() is returning an Owner object with a valid getId() but everything else uninitialized. A.getOwner() is fine, as are all other fields in A and B.
Incidentally, why aren't I getting the same pojo for the two different owners? They have the same id, and they're coming from a single session.load() call. If I got more reuse of my Owner objects I'd be very happy.
I've verified that the generated SQL in complete (in the above example, the Owner table is joined to twice) and I've run the SQL and the results are good; it's just that the non-id fields in the second Owner join aren't retrieved into the pojo.
I'd be happy with a "read the manual" response, if it included chapter numbers and maybe some sample code :)
|