Grails

discard() evicts the object

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.1-beta1
  • Component/s: Persistence
  • Labels:
    None

Description

It looks like I get a side effect of discard(): an exception is thrown in my gsp after I call discard on the object passed to the gsp: Hibernate cannot lazily load a Set property of the object, complaining the session is closed. I ended up by doing a obj.refresh() to solve the issue but I am wondering if it is clean to do so.

Thanks

Fred

================================================================
Graeme Rocher <graemerocher@yahoo.co.uk> to user

This is a bug, please raise an issue

It doesn't close the session, but it evicts the object. save() used to
do this on validation failure, but we corrected the problem

Activity

Hide
Matthias added a comment -

I can confirm this issue for a June SVN snapshot of Grails 1.0.3.

This is a serious problem, any workarounds?

Show
Matthias added a comment - I can confirm this issue for a June SVN snapshot of Grails 1.0.3. This is a serious problem, any workarounds?
Hide
Graeme Rocher added a comment -

This has been corrected by GRAILS-3163

There should be no need to call discard() as objects are set to read-only if a validation error occurs. If you want to re-attach after call discard() you can use the attach() method

Show
Graeme Rocher added a comment - This has been corrected by GRAILS-3163 There should be no need to call discard() as objects are set to read-only if a validation error occurs. If you want to re-attach after call discard() you can use the attach() method

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: