Expand my Community achievements bar.

Accessing LCDS Persistence Layer for use in Server-Side Business Logic

Avatar

Level 1

Within server-side business logic, I want to be able to get a persisted object from LCDS, manipulate  that object, and then use LCDS to persist those changes to the database  as well as send those changes to the client.

Is it possible to access LCDS' persistence layer (Hibernate) to be used by server-side business logic?

I have attempted to use DataServiceTransaction.getItem(...).  However, for objects that contain a collection of other objects I get this error:

[LCDS] Runtime exception while trying to fetch a property from hibernate: flex.data.DataServiceException: There is no current message broker to return.

When calling DataServiceTransaction.updateItem(...) for objects that contain a collection of other objects, I get this error:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sd.pojo.Book.chapters, no session or session was closed

Also, it appears that DataServiceTransaction.updateItem does NOT update the database?

I have resorted to building my own Hibernate SessionFactory, but that seems unnecessary.

One other piece of information is that I am using the Fiber modeling tool to build and deploy the model to the server.  I am generating the Java classes with Fiber and making them available to be used on the server.

Thanks,

Collin

0 Replies