Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News InfoQ Article: Grails + EJB Domain Models Step-by-Step

InfoQ Article: Grails + EJB Domain Models Step-by-Step

This item in japanese

Grails could bring Ruby on Rails style productivity to the Java platform, built on the Groovy language and fully integrated with Java. In this tutorial, Jason Rudolph shows how to use Grails to quickly build a functional website around an existing EJB 3 entity bean domain model with very little code.  Read Grails + EJB Domain Models Step-by-Step.
As one impressive example of its enterprise integration abilities, Grails let's you quickly and easily build a web application backed by your existing EJB3 entity beans. But, it doesn't stop there. Grails gives your entity beans a hearty shot of steroids, but does so completely dynamically, without altering your EJB source code in any way. Grails Object Relational Mapping (GORM) is built on Hibernate 3 (but will eventually offer support for the Java Persistence API) and uses Groovy's Meta Object Protocol (MOP) to add all sorts of handy dynamic methods to your otherwise-static entity beans. And those methods are not only accessible from Grails and Groovy; your Java code can invoke those methods as well! We suddenly have all the enterprise-level capabilities of JEE/EJB3 and the benefits of RAD web application development!
The integration angle is quite important, as reuse of existing investments in Java is a commonly cited problem the Java community has been saying about using Ruby on Rails.  Grails brings a RAD framework bound together with our own dynamic language (Groovy) which is part of the Java platform.  Integrated stacks RAD stacks with a strong EJB focus is an area of innovation for a number of frameworks wuch as RIFE, Trails, JBoss SEAM (JSF+EJB), but Grails is the only one built around the Groovy dynamic language.  Could Grails become the Java community's answer to Ruby on Rails?

Rate this Article