No problem a few google searches later and I have some code that looks like:
import org.hibernate.FetchMode as FM
def c = Person.createCriteria()
Person person = c.get{
eq("username",params.username)
fetch("resumes",FM.EAGER)
}
Turns out this works fine, however when using this invoking this after creating a new resume. So the scenario of walking through a series of screens to create a new resume and then going back home to the user's home page where the resumes are displayed as links in the sidebar again blows up with the Object already in session.
The solution to this issue is to not call save at the end of the flow for creating a resume but rather call the merge method this will clean up the Hibernate session and allow the above EAGER fetch to proceed without additional problems.
if( !resume.merge() ){
// do something
}
No comments:
Post a Comment