views:

906

answers:

7

I am looking for a Java implementationation of the ActiveRecord pattern which is built on top of Hibernate.

In .Net there is a open source project Castle Windsor ActiveRecord which implements the ActiveRecord pattern on top of NHibernate.

I'm looking for something like this, except sitting on top of the NHiberate persistence frameowork for Java.

A: 

GORM in Groovy / Grails?

Dutow
+1  A: 

Well, GORM in Grails cannot be detached from Grails - until version 1.1 is out at least. And frankly, there are quite few differences between GORM and AR (eg: in Grails, you model your domain objects and GORM will infer the database structure whereas in AR, you have your table on the one hand, and your object on the other). Oh, and one more difference is that GORM has a lot of quirks to it. Notice I didn't say bugs...

Anyway, here's another similar post here on stackoverflow which may cover what you're after: Is there an implementation of the ActiveRecord pattern in Java like the one from Ruby?

Cheers,

Rollo

Rollo Tomazzi
+2  A: 

I would say GORM is a better pattern for using with Java that ActiveRecord. ActiveRecord ultimately requires more work and more coding than GORM. From what I can tell, Django follows the GORM model more than it does the AR model, so that model might be something worth looking into, especially given that Java probably wouldn't lend itself to dynamic getters and setters as Ruby does (unless you starting delving into generating bytecode on the fly, but your compiler and IDE wouldn't like that very much).

Nathan
+1  A: 

Actually, I have been working on AR - like framework in Java, first blog: http://igorpolevoy.blogspot.com/ cheers, igor

ipolevoy
A: 

Scooter Framework has an implementation of ActiveRecord very similar to Ruby on Rails: http://www.scooterframework.com/

rtacconi
+1  A: 

I released a project called ActiveJDBC: http://code.google.com/p/activejdbc/. This is what you are looking for thanks igor

ipolevoy
A: 

I released ActiveJDBC, which is implementation of ActiveRecord in Java: http://code.google.com/p/activejdbc/

enjoy

igor

ipolevoy