4 ms·
Can anyone who's got Hibernate and ActiveRecord experience give a quick shot on the big differences? I haven't used ActiveRecord.. but spent years with Hiberna
by famousactress 16y ago
Can anyone who's got Hibernate and ActiveRecord experience give a quick shot on the big differences?
I haven't used ActiveRecord.. but spent years with Hibernate, and consider it a pretty impecable project compared to other ORMs I've encountered (J2EE's CMP, and Django's ORM, specifically.
- kpanghmc 16y agoI've used NHibernate (which is the .NET port of Hibernate) and Rails ActiveRecord. The biggest difference to me is that Rails ActiveRecord encourages you to work from the database first. That is, you define your database tables and columns which are then used to generate your classes. In contrast, NHibernate (and I'm assuming Hibernate as well) encourages you to design your classes first and worry about persistence later. There are merits to both approaches. In general, I'd say that Rails ActiveRecord is much easier to use and get started with while NHibernate allows for more flexibility in your domain model.
- jarin 16y agoIf you prefer the flexibility of the class-first model, it might be better to use something like Mongoid (with MongoDB) instead.
- kpanghmc 16y agoOr DataMapper if you want to keep using a relational database as your persistence medium.
- xentronium 16y agoBtw, datamapper has a mongo adapter too, so it isn't restricted to RDBMS.
- minalecs 16y agofrom programming interface, the new Active Record Query Interface 3, is very similar to HIbernate Criteria API. I wish they could of been more specific on what issues they had with Hibernate. Other than that the comments about dynamic creation are correct. In Hibernate they try to create the idea that you're object model doesn't need to be a 1:1 model with your data model.
- famousactress 16y agoOh! of course.. that's definitely a really good point. Hibernate's HQL.. Frankly, I never got much use of Hibernate's Criteria stuff.. was always a second class citizen compared to HQL, other than for certain use cases that really demanded dynamic query building. Even Django's ORM runs circles around Criteria.. in fact, the API design of the Django stuff is the one thing that I think really shines about it..