Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there anything close to Active Record for Java?

 
Robert Hill
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic