Is there anything close to Active Record for Java?
posted 8 years ago
It might be a pointless question, since Java is so different then Ruby.
For those not familiar with Active Record it is a wonderful tool for Ruby on Rails. It abstracts SQL statements into Ruby method calls. Ruby is flexible enough to handle creating new methods for a class dynamically.
As an example:
Message.new(params[:message]).save creates and saves a new row in the Message table using parameters from a HTML form. The Message class has dynamically created methods to manipulate the row, and makes validation a breeze.
Before this sounds like an ad for Ruby on Rails, and a condemnation, which is not the intent, here is my question. Most of the SQL I use is the same sort of thing over and over. So it is tedious to have to write SQL statements in Java code. Before I attempt to write some simple wrappers to help DRY out some Java code, Does something like this already exist for Java. I doubt Java has something exactly the same, but something reasonably close would be great.