BT

Easy Persistent Entity Transfers

by Craig Wickesser on Apr 27, 2009 |

Gilead is a library which enables the ability to,

send persistent entities outside the JVM without pain.

Gilead, which stands for Generic Light Entity Adapter, was previously named Hibernate4GWT. The name change came after the developers began supporting other frameworks,

Since Gilead now handles more than just GWT front-end, and support of other JPA implementations than Hibernate is planned, we looked at a more generic name.

The primary reason Gilead was created was to ease the pain that is sometimes incurred when sending persistent entities to other systems or front-end technologies. Usually the problem occurs because the persistence frameworks will alter classes during compilation or runtime, to include information they require, to ease the pain related to persisting entities. Then when these altered objects are passed around strange things happen and errors such as "NoClassDefFoundError", "ClassCastException" are thrown by the receivers.

Gilead gets around this by using a clone and merge strategy. When objects are being sent out from the server they are cloned,

Clone takes a persistent entity and creates a neutral instance, without neither proxies nor persistent collection.

When the objects are being returned to the server they are merged and Gilead performs this in one of three "modes".

  1. stateless: Your classes must extend LightEntity or implement ILightEntity which enables the persistence information to be stored on the cloned object (no information is left on the server).
  2. stateful: The persistence information is stored in the HTTP session.
  3. dynamic proxy: An experimental, stateless mode useful in situations where existing code can not be modified to fulfill the requirements set forth by the stateless mode.

Gilead is currently at version 1.2.2 and provides stable clone/merge operations for applications which use Hibernate as their JPA framework. The stable adapters provided by Gilead for sending entities to front-end technologies include GWT and Flex (using BlazeDS).

The next release, version 1.3, plans for an XML/Web Services adapter, support for OpenJPA (with EclipseLink later on the road map) and other improvements.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT