fredag, april 13, 2007

ActiveHibernate - Any takers?

This is a call for action. JRuby on Rails is getting more stable each day, and JRuby performance is consistently improving. This means that JRuby on Rails is well on the path of becoming a viable platform for several kinds of web development.

ActiveRecord-JDBC is central to this, and it's a good project and works very well. Within the limitations of ActiveRecord, of course. So, I'm thinking (and this is by all means not a new thought), that I would like to have the rest of Rails, but using Hibernate as backend. With JRuby approaching 1.0 fast, ActiveHibernate seems like a neat project. The only problem is time. So why is ActiveHibernate tempting? Well, for all those situations where ActiveRecord really doesn't fit; composite keys, complicated legacy systems. Or databases where you would like to use prepared statements for everything. Or get really nice speed.

What needs to be done? For it to be really useful, there are few points: First, a Hibernate extension that serializes and deserializes into RubyObjects. By doing it that way, there is no need to create Java bean classes. Secondly, provide all the useful help functionality around the Hibernate implementation, that AR users have gotten used to. This includes things like validations, automatic handling of updates and inserts, and is generally about doing a good Ruby interface around Hibernate. This also includes creating a good way of configuring Hibernate without having to resort to the XML. Maybe using YAML? Or a Ruby DSL? After that has been done, the final point is easy: get mind share and start doing applications with it! I for one know that I would like to use such a project!

8 kommentarer:

Andy sa...

Have you followed the DataMapper project on ^Substantiality?

http://substantiality.net/archives/tags/datamapper

Stephen sa...

I'm somewhat more interested in what Charles had posted about a few weeks ago: JRuby + Grails; though it's a gut feeling as I haven't used Grails nor Rails for anything yet. At a minimum, I would think that examining GORM (the portion of Grails that handles using Hibernate for persistance of Groovy beans) would be a good first step here.

Charles Oliver Nutter sa...

I think ActiveHibernate would be a great idea...but a few other possible ideas to consider:

ActiveJPA: allow all Java Persistence frameworks to be swapped under the covers

ActiveBatis: iBatis apparently allows you to create dynamic models at runtime, which fits a little better with the data-driven approach. Grails, using Hibernate, has to build pojos for every table and keep them in sync.

I think any attempts to start providing core Rails modules as Java equivalents would be a superb use of time.

Unknown sa...

Grails has done exactly this for groovy, and from what I know of their approach I like it a lot. There's no need for hibernate configuration files as such because they wanted it to be by convention like active record. It ought to be straightforward to look at their approach and replicate it in JRuby.

Anonym sa...

As long as we don't loose migrations.

Mike Norman sa...

The 'ActiveJPA' idea is very interesting to me. I work for Oracle on TopLink. We contributed a subset of TopLink as the RI for the JPA portion of the EJB3 spec. We also had one of our gurus Mike Keith as co-lead on EJB3 committee. Oracle TopLink goes far beyond the EJB3 spec (non-JDBC backends, O-to-XML, DB-specific features, etc.) and just ~2 weeks ago, we announced we are contributing the whole of TopLink (not just the subset for JPA RI) as a new open source Eclipse project (http://www.eclipse.org/proposals/eclipselink)

johan andries sa...

The summer seems like a nice time to give this a serious try.

Unknown sa...

Did anybody ever follow up on this idea? Been thinking of implementing it myself lately.