4 ms·
That's funny... knowing that ORMs aren't everywhere actually makes me more likely to use Go. I still have Hibernate flashbacks.
by mbreese 14y ago
That's funny... knowing that ORMs aren't everywhere actually makes me more likely to use Go. I still have Hibernate flashbacks.
- boundlessdreamz 14y agoHave you used rails ORM (activerecord) or sqlalchemy ? (I haven't used the latter much but people rave about it). Hibernate is an ORM taken to the extremes
- lobster_johnson 14y agoHibernate is not a good example of an ORM, frankly. (I myself have horrors of both Hibernate and TopLink, which was the top Java ORM way back when.) Ruby's ActiveRecord is a much better choice. It has an excellent balance between SQL and OO. It doesn't pretend that SQL doesn't exist; on the contrary, it encourgaes SQL use, and merely maps tables to objects, adds a bunch of useful features (data validation, change management, automatic joins, declarative migrations) and gets out of your way most of the time. For example: users = User.where("created_at > ?", Time.now - 1.year). order('name').limit(10) Results are lazily loaded and composable, so you can do: users = User.where("created_at > ?", Time.now - 1.year) if (page = params[:page]) users = users.offset((page - 1) * 10).limit(10) end Joining is easy: users = Users.joins(:accounts). where(accounts: {type: 'facebook')).first becomes something like: select users.* from users join accounts on accounts.id = users.account_id where accounts.type = 'facebook' limit 1