Beginner |
|
Joined: Fri Mar 12, 2004 8:40 pm Posts: 30 Location: SF Bay Area
|
Suppose you have two objects A and B.
There is a one to many relationship between A and B.
Both A and B are created using the code generator.
Object A has a "public A getBs()" method and reverse
lookup for both A and B is set to true.
In A.hbm.xml lazy initialization for the set of Bs is set to true.
The question is ... is there a good design pattern, or
a recommended method for initializing the B's in the A object?
(Something other than changing lazy to false or by passing
the lazy setting in the code but essentially doing the same thing.)
Note that Hibernate.initialize(A.getBs()) does not work because
A.getBs() returns null.
It is possible to add an BsInitialize() method to the A java file
but this requires hand editing A.java class and making the
set of Bs public.
Any suggestions?
Thanks
|
|