Bindings, Platforms, and Innovation
This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.
Tracking change and innovation in the enterprise software development community
Posted by Floyd Marinescu on Aug 22, 2006 01:13 PM
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?
Download the Free Adobe® Flex® Builder 3 Trial
Adobe® Rich Internet Application Project Portal
The Agile Business Analyst: Skills and Techniques needed for Agile
A legacy approach to using EJBs. Wow that speaks volumes. And do it with another language. Ouch. Floyd I cant figure if you think Java has a future or if you think we should all party on the VM like it was (a) 1999 (Corba container). This is what frustrates me about the Java space right now. Everyone is so rattled by ruby and scripts and trying to wedge Java in a buzz trend that is so far removed from where Java is that its not even worth discussing Java in a "rails" context. Or discussing rails in an EJB context. If we have to port rails to the JVM to be happy then maybe we should just use the ruby interpreter and support its toolset and let IBM handle the legacy integration as they are so keen to do. Its not interesting or all that relevant.
I think you missed the point - the article doesn't treat EJB as legacy, it's about developing a domain model in EJB and using Grails to quickly build a web app around it. Considering strategies like Domain Driven Design, focusing on your domain model in Java and generating the UI around that is an emerging best practice that tools like Grails can enable.
Where was it mentioned that EJB3 is legacy? Grails is all about embracing Java, the platform, language and tools. Java has a huge future and it speaks volumes for the strength of the platform that Grails and its underlying frameworks (Spring, Hibernate, SiteMesh, Quartz etc.) exist. In terms of porting Rails, well yes that is one option, but Rails (as with Ruby's runtime) has a very different object model and idioms for developing web applications. One that its contradictory to existing knowledge about specifications like Servlets, JSP and, indeed, EJB. Grails is not a port of Rails and in fact is very different in many ways including how it is based on Java frameworks.
"built on the Groovy language" and "fully integrated with Java" "built on the PL/SQL language" and "fully integrated with Java" "built on Javascript language" and "fully integrated with Java" "built on ActiveX" and "fully integrated with Java" "Built on Flash" and "fully integrated with Java" I didnt miss the point. The point was accessing EJBs with something other than Java. And if EJB 3 is a big plus in combination with another language then *something* in this picture just went legacy. And something just went "integration strategy" Thats how you know what legacy is and isnt.
If we were talking about using Grails to build a front-end to a VSAM file, I'd agree with you that we're talking about legacy integration; however, that's not the case.
There's a distinct difference between...
* Using a current technology to integrate with a pre-existing (legacy) application,
versus...
* Using a current technology (like Grails) in concert with another complimentary and current technology (like EJB) to build a new application.
The point was accessing EJBs with something other than Java. And if EJB 3 is a big plus in combination with another language then *something* in this picture just went legacy.
I respectfully disagree. We've long been dependent on another language to make our Java apps work. That language is XML, and XML does not make Java a legacy language. They're complimentary technologies.
If the goal is to build a web user interface for your EJBs (which are, by their very nature, business-tier components), chances are you're going to invoke some other (complimentary) technology for your web tier. Maybe it's just JSP. Maybe it's Struts or Spring MVC or Tapestry or Grails. The use of those complimentary technologies does not make EJB a legacy technology. It's instead a choice of using the most efficient tool for the job at hand. And for many applications, Grails offers the productivity gains to make it a strong contender to be that tool.
OK Ill give you that, but you cant ignore the undercurrent of the Java space right now which is desperately trying to wedge the competition into its model out of fear of outright rejection. What if the smalltalk guys had insisted that Java run in a smalltalk VM? What would people have thought of them? The smalltalk VM was way ahead of Java in the early days. So now the Java scene wants to steal ruby and rails from the cradle and I say well if Java is so great then let Java solve its own problems without coopting the vibe of the scripting languages. I think Java is trying to change before anyone acknowledges or speaks aloud of a greater failure of OO or more specifically Java projects to deliver.
I think Java is trying to change before
anyone acknowledges or speaks aloud of a greater failure of OO or more
specifically Java projects to deliver.
I read in a magazine a couple of years ago that "the Hummer is the greatest off-road vehicle we ever drove". And "with a Hummer you can get through any terrain except through narrow streets".
Java, Groovy and Ruby are great in many areas but none is great in all areas. Particularly, Java is not so great to write web handlers. Alternatively you could use Ruby and Rails or Grails if you want to reuse Java code. In fact, we've created Grails to augment the Java platform.
You can hate us for doing so and being successful. There's however no need to start a flame war.
Any reason why the relationaship management code can't be generated too? It was a little anticlimactic to learn that the developer had to manually edit the generated groovy code just to handle the object relationaships. I'm assuming all that info is stored as annotations in the EJBs.
Hi, I followed up this step-by-step and successfully run 'grails run-app'. Everything looked great except this case: I assigned 3 computers to an employee, for example, jane and I got 3 instances of the same 'jane' listed in the browser(IE6.0) when I click on employeeBean list link. That seems a bug. How can I fix it? Thanks.
This is one the todo list: http://jira.codehaus.org/browse/GRAILS-172
Good catch. Thanks for your feedback. There's apparently problem with the dynamic list method, which is used to fetch the list of employees. You can track the problem here: http://jira.codehaus.org/browse/GRAILS-284
This is a really great article and does a very nice job of showing off the features of Grails. However, I was sort of hoping for an article about integrating Grails and EJB. As it is, the author just illustrates the flexibility of the new EJB pojo implementation as well as the rapid development capabilities of Grails. What I'd like to see (and I believe is slated for a release later this year) is the ability to map those beans to/from ones already deployed on an existing EJB container instead of simply using Hibernate and copying the pojo implementations into the project. Maybe this is already possible using some tricks with the Spring configuration, but I don't know Spring well enough to say. In any case, thanks for a great article!
Randall, Your comment is exactly what I was thinking! I read the article and there's no mention of an app server or anything like that! Just copying the entity code and using that. While Grails looks cool, we've got a lot invested in the JEE resources. Guess we'll have to see what develops!
Yes, thats what I try to find out as well.
Would it be possible to the content of this article in pdf format, to be able to read it offline and print it nicely? Thanks.
Hi, I am stuck following your steps in a very early stage ("run-app" directly after "create-app"): (I am running the grails / groovy-versions mentioned above with JDK 1.6.0_03 on Windows XP SP2) > grails run-app Welcome to Grails 1.0-RC2 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: C:\Programme\Dev\grails-1.0-RC2 Base Directory: c:\Arbeit\Allgemein\Dev\Projekte\GrailsTest1 Environment set to development Note: No plugin scripts found Running script C:\Programme\Dev\grails-1.0-RC2\scripts\RunApp.groovy groovy.lang.MissingPropertyException: No such property: war for class: java.lang.String at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:48) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:474) at Config.run(Config.groovy:62) .... Do you have any hints for me? Kind regards Michael
Hello again, FYI: just fixed the error by changing the line grails="error" to grails.app="error" in the generated file "grails-app/conf/Config.groovy". Kind regards Michael
When I try out the tutorial I get an error which is logged in the JIRA (GRAILS-2042). However there seems to be no action on this issue ? Any workaround available for this ? (am using Grails 1.0 RC3) - Venky
Jason, Thanks for the article - it's awesome. I was wondering what needs to be done to make the following search scrollable...being very new to grails, i'm having a real hard time figuring it out...
I went through Step 1 to 3 with following changes in ejb3_grails dir ./src/java/com/jasonrudolph/ejb3example/entity/EmployeeBean.java ./src/java/com/jasonrudolph/ejb3example/entity/ComputerBean.java ./grails-app/conf/hibernate/hibernate.cfg.xml ./lib/mysql-connector-java-5.1.6-bin.jar ./grails-app/conf/ApplicationDataSource.groovy I am not sure about hibernate.cfg.xml location. At Step 4 - Generate the Scaffolding, I got an error. % grails generate-controller ..... No domain class found for name com.jasonroudolph.ejb3example.entity.EmployeeBean. Please try again and enter a valid domain class name How to move forward? Thanks for the help!
This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.
This article explores the use of JBoss and jBPM to implement design solutions that effectively address the issue of orchestrating long running activities.
This presentation covers the use of graph databases as an optimal solution for data that is difficult to fit in static tables, rapidly evolving data or data that has a lot of optional attributes.
This session introduces Real Options and shows how it can help in running your project. Real Options is a decision-making process that can be used to manage risk.
This article discusses the use of bindings on services and references (including the instance of non-configured bindings) as the means to implement SCA communications in a Web and SOA environment.
After a short introduction to DSLs, Scott Davis plays with the keyboard showing how to approach the creation of a DSL by typing working snippets of Groovy code that get executed.
IBM Rational and InfoQ present, Scaling Agile with C/ALM, an eBook showing organizations how to become “finely tuned software delivery machines” by enabling team integration and scaling.
Amanda Laucher presents a real life enterprise application written in F#. She shows actual code snippets, explaining design decisions and suggesting how to use some of the F# constructs.
20 comments
Watch Thread Reply