We have a medium size Java application that needs some refactoring.
We are considering migrating towards JRuby on Rails. Mainly because of the productivity that Ruby on Rails offers and for the many existing plugins that will reimplement the web logic.
However a large part of the application should stay in Java, we do not want to rewrite all the business logic (specially since it uses many Java technologies such as RMI).
A key point for our refactoring is sanitizing our database management, which is currently a mix of hand coded SQL operations and some objects stored in db4o.
From JRuby we can call any legacy java code. Great!
However many Ruby on Rails plugins asume the use of ActiveRecord to manage the database. Accessing the ActiveRecord data from Java seems non trivial.
Which is best strategy to manage the database between JRuby on Rails and the legacy Java code?
- We could use db4o for everything, but would loose the benefit of some Ruby on Rails plugins, and would need to manage objects "manually" on the Ruby side
- We could use ActiveRecord for everything and define some kind redundant mapping on the Java side. Which would be the best strategy?
- We would use a Java ORM technology (Hibernate, Cayenne?) and then map the model in ActiveRecord. How does this idea compare to the previous one?
- Can we do some magic using Jruby 1.4 become_java!?
What do you think?