Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ah, I'm not the only one who thinks ORMs suck! That's why I love the latest development in the Scala community towards a non-ORM solution for persistence: Slick (http://slick.typesafe.com) and Play! Anorm (http://www.playframework.org/documentation/2.0/ScalaAnorm)


I don't hate ORMs, but I hate when they are too intrusive. What I like about Ebean is that it was designed to only handle the simple stuff "ORMish" and provide a very smooth and easy breakdown to raw SQL so you get the best of both worlds. I also love "autotune", it tracks your call stack for queries and after it has enough statistics it'll start only fetching the fields that you actually ended up using. So if you have an object with 25 fields and one page A you only use 5 of them, it'll only fetch those 5, but since its based on a the call stack and not hardwired into the model, it can can track that you used 5 different fields on page B and optimize that query too.


I didn't quite understand it. From your example, it looks like ORM layer knows about 'pages', which are in views. Isn't it against clean separation of concerns?


It doesn't know about pages, it knows about the stack trace that resulted in a query being generated, e.g. it know that a specific method in the ProductController called a specific method in the ProductService, etc, leading to a query being generated.

It also know which fields of the object it returned were accessed prior to going out of scope and more importantly, which fields were never accessed. With those two bits of information gathered over many calls it can figure which fields are actually worth fetching from the database and which should be left off and fetched lazily in the odd case that they are needed.


I see. Ebean looks interesting! I'm kinda stigmatized because of Hibernate and therefore avoid any persistence library that calls itself an ORM :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: