This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Is there anything close to Active Record for Java?  RSS feed

 
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!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!