Originally Posted by fschroder
Here’s one of them:
public class PersonRoleInitPlan implements InitializationPlan<AbstractPerson> {
public void init(AbstractPerson o) {
Hibernate.initialize(o.getRoles());
}
}
I could have initiliazed the roles collection by “iterating” it (to avoid coupling the domain with hibernate), for example:
public void init(AbstractPerson o) {
o.getRoles().size();
}
The anonymous approach seemed nice to me, but I’m using RMI, and using anonymous classes means it will also send the top level class through the network, something I’d like to avoid, so I ended with named initializers.