5 ms·
Has play stopped using Ebean? It's my favorite Java ORM and I've never heard of Anorm.
by mbell 14y ago
Has play stopped using Ebean? It's my favorite Java ORM and I've never heard of Anorm.
- jaytaylor 14y agoYou can of course use whatever ORM you want, but it comes with Anorm.
- jiggy2011 14y agoCan Play 2 be made to work well with hibernate+JPA? I know many people don't like it , but I invested a fair amount of time into understanding hibernate and if I stick with the JVM I would want to be able to apply that.
- mark242 14y agoYes, it will work. There's no magic sauce about adding whichever ORM you want; just declare it as a dependency in your build file and you're ready to go.
- jiggy2011 14y agoThanks, is there anything "weird" about it though? For example: I remember in play 1.x various helper method were provided that were different from those in standard JPA including something that felt like properties in ruby. Not really a problem in practice, but required a litte trial and error when compared with the hibernate docs. However I imagine Play 2 makes use of various dynamic style programming techniques (via Scala) that might make hibernate behave in subtly different ways to what the hibernate literature might lead you to believe? I appreciate that this is an extremely hand-wavey question.
- mark242 14y agoPlay uses Ebean on the Java side of the fence. Anorm is for Scala users. Here's how to do a query for a person in Anorm: SQL("select * from person where id = {id}").on("id" -> myAgeVariable).map(row => MyPersonObject(row[String]("name"), row[Int]("age"))).toList ...returns you a list of MyPersonObjects. No need for JPA bindings or any other annotations. Based on type safety, you must have the method MyPersonObject.apply(name: String, age: Int) or else the compiler will error. It's a great way of catching SQL funkiness inside your IDE.
- alexatkeplar 14y agoYech, embedding raw SQL strings in a typesafe, compiled language like Scala is so full of fail it's not funny. Hopefully they'll switch out Anorm for Slick (which is also a Typesafe project - http://slick.typesafe.com/ http://slick.typesafe.com/) soon.
- codewright 14y agoEbean vs. Anorm vs. Slick is a good example of why I don't like using full-stack frameworks. When I use minimalist web frameworks, I get to use best-of-class libraries across the board, not make decisions based on damage control. Examples of minimalist web frameworks: Sinatra, Flask, Scalatra, Ring/Compojure
- tommi 14y agoThere's nothing blocking from using Slick or any ORM in Play.
- alexatkeplar 14y agoYep, I do like the Ring/Compojure philosophy. Actually we just open-sourced a pixel server based on Ring/Compojure yesterday (https://github.com/snowplow/snowplow/tree/master/2-collectors/clojure-collector https://github.com/snowplow/snowplow/tree/master/2-collector...)
- eeperson 14y agoAgreed, about about Ebean being the nicest Java ORM. Ebean's lack of a stateful session seems much less maddening than Hibernate. I wonder why it isn't used more.