I'm attempting to lazy initialize my one to many relationship using Spring's Hibernate Template.
I have read the following guide. http://dinukaroshan.blogspot.sg/2012/08/lazyeager-loading-using-hibernate-by.html
with the reference to these codes
/**
* {@inheritDoc}
*/
public Child getChildByIdWithoutToys(Long childId) {
return getHibernateTemplate().get(Child.class, childId);
}
/**
* {@inheritDoc}
*/
public Child getChildByIdWithToys(Long childId) {
Child child = getChildByIdWithoutToys(childId);
/**
The above code uses 2 session and 2 sql statement(expose sql)
Is there a way to perform this in one session and one sql statement(hibernate_showsql=true)