Issue Details (XML | Word | Printable)

Key: GRAILSPLUGINS-1663
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: James Lorenzen
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails Plugins

Default delete action throws exception

Created: 06/Nov/09 11:44 PM   Updated: 28/Nov/09 03:17 PM
Return to search
Component/s: Grails-GORM-JPA
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive test.zip (164 kB)

Image Attachments:

1. gorm-jpa-delete-exception.png
(247 kB)
Environment: Linux, jdk 1.5, grails 1.1.1, app-engine 0.8.5, gorm-jpa 0.5


 Description  « Hide

Received an exception when trying to delete when using the unmodified controller created by generate-all.

Steps to reproduce

  • install gorm-jpa
  • create domain
  • generate-all for domain
  • grails app-engine run
  • Using the create page to create a new record. Click Create
  • On the show page, Click the Delete button and Click OK.
  • Received the following exception (see attachment as well)
    Caused by: javax.persistence.TransactionRequiredException: This operation requires a transaction yet it is not active

Solution

  • I was able to see the Event.withTransaction closure for the save action and used that in the delete action and that solved my problem. My guess is the auto generated controler provided by gorm-jpa just needs to include this like it already does .save(flush:true) for the save action.

Event.withTransaction { eventInstance.delete(flush:true) }

Also, it was nigh impossible to find the affected version for this plugin/version. Sorry for not setting it; just really difficult.



James Lorenzen made changes - 06/Nov/09 11:45 PM
Field Original Value New Value
Attachment gorm-jpa-delete-exception.png [ 45683 ]
Scott Murphy made changes - 28/Nov/09 03:17 PM
Attachment test.zip [ 46111 ]