Bug 790649 - REST Interface - Unable to update since Lazy loading was implemented
Summary: REST Interface - Unable to update since Lazy loading was implemented
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: PressGang CCMS
Classification: Community
Component: REST-API
Version: 1.x
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Matthew Casperson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-15 03:59 UTC by Lee Newson
Modified: 2014-08-04 22:26 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-15 23:46:26 UTC


Attachments (Terms of Use)
Test Case (1.64 KB, text/x-java)
2012-02-15 03:59 UTC, Lee Newson
no flags Details

Description Lee Newson 2012-02-15 03:59:04 UTC
Created attachment 562110 [details]
Test Case

Since Skynet was changed to use Lazy Loading updating entities that contain lazy loaded collections now fails via the REST Interface. One of the errors is:

"org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.redhat.topicindex.entity.Topic.childTopicToTopics, no session or session was closed"

I believe this error to be the cause of attempting to retrieve collections (eg in createRESTEntityFromDBEntity) after committing a transaction. Closing the transaction closes the session/proxy that the lazy loading would normally use.

I've attached a Test Case to demonstrate that creating an entity works because everything is loaded before the transaction is committed, while attempting to update an entity fails.

Comment 1 Matthew Casperson 2012-02-15 21:32:35 UTC
Fixed in 20120216-0726

The BaseRestv1.updateEntity() method now modifies the database entity and expands the returned REST entity in one transaction.


Note You need to log in before you can comment on or make changes to this bug.