InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Easy Persistent Entity Transfers

Posted by Craig Wickesser on Apr 27, 2009

Sections
Development,
Architecture & Design
Topics
Java ,
Persistence
Tags
BlazeDS ,
Flex ,
GWT ,
Gilead ,
Java SE ,
Java EE ,
Hibernate

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.

No comments

Watch Thread Reply

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.