ORM: ActiveRecord vs Hibernate
While writing my last article I couldn't avoid comparing ActiveRecord and Hibernate. Although they apply different patterns in the Object Relational Mapping, they share the same fundamental purpous: mapping a relational database to objects and vice-versa.
Here's how AR stacks up with Hibernate in terms of number of lines of code.
-
CREATE TABLE miners (
-
id BIGINT NOT NULL AUTO_INCREMENT,
-
first_name VARCHAR(255),
-
last_name VARCHAR(255),
-
PRIMARY KEY (id)
-
)
-
class Miner <ActiveRecord::Base
-
end
P.S. - This has improved in Java 6 but still...




That ActiveRecord stuff seems great… Why do you feel that Ruby (as many other languages) lack enterprise-wide adoption? Is it because it’s not supported by a big company, such as Sun or MS?
Well Pedro, I guess that there’s three major motives: first, it has just recently escaped from its hole thanks to Rails. It’s getting known and widely tested by the geeks and then by the enterprise.
Secondly, there are still some myths around scalability. Despite the fact the in most of the cases the bottleneck lies on the database, Ruby has yet to prove itself in what concerns to scalability. Mongrel, LiteSpeed and ngnix are helping fixing this but it’s still vague.
Thirdy, it lacks proper IDEs. If you recall, all the languages that enjoyed widespread enterprise adoption, Java, VB/.NET and Delphi, had great IDEs backing them up. Refactoring is absolutely crucial so is auto-complete. The lack of these functionalities has been a show-stopper in developing IMAGE.
Thanks your for reply.
Sooner or later you’ll have to uncover what that IMAGE project is all about! :)
Yeah, I’ll have to talk about it :-)
I was unable in getting Wordpress to not remove the < / a > tag so I’ll try putting it here.
Recommended reading: ActiveRecord vs Hibernate - The ORM showdown