Easy Persistent Entity Transfers
Gilead is a library which enables the ability to,
send persistent entities outside the JVM without pain.
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".
- 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).
- stateful: The persistence information is stored in the HTTP session.
- 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.