I would say, first check out querulous which is a convenient lightweight wrapper around JDBC, and see if that does enough. If not, either Squeryl or ScalaQuery is probably worth a look. I like Squeryl, your mileage may vary.
Of course, my favorite option is not to use a SQL DB at all, if I can use MongoDB it's a new world of speed, and when you don't need all the constraint stuff, Mongo is pretty well a functional equivalent (better in some ways). Best of luck Dick On Jun 15, 1:12 pm, Jan Goyvaerts <java.arti...@gmail.com> wrote: > Okay - so maybe my mistake is to try using a Java ORM solution for Scala. > :-) And maybe there are bit too much byte code weaving tricks involved > here... > > What persistence solution would you advise for newbies ? The Squeryl you > mentioned ? > > > > > > > > On Wed, Jun 15, 2011 at 19:28, Dick Wall <dickw...@gmail.com> wrote: > > Well - that's a really interesting question. Certainly JPA could be > > scala-fied somehow, but that's not the reason I don't use it any more > > (I have nothing against annotations even if they sometimes look a bit > > awkward in Scala). The reason I look for other alternatives now is > > that JPA pretty much totally relies on mutable state (vars rather than > > vals) - the fields are all filled in after initial instance creation. > > Squeryl and other options in Scala opt for a more idiomatic immutable > > model (although you can make them mutable if you want), so everything > > ends up as vals or (often more usefully) lazy vals, even the results > > of relationships. > > > This does take a little getting used to, the "new" way often involves > > making a database update through a DSL expression (like a SQL update > > statement, which leaves the original object intact and just changes > > the data in the database), and then re-querying the object to get it > > in its new state, rather than just updating fields and saving the new > > object. It's a trade-off I willingly make though for the extra safety > > and consistency of handling only immutable instances in my programs. > > It ends up being a bit like a database enforced STM. Another advantage > > is you can easily disconnect these objects from the database and hold > > them as simple in-memory representations, getting a ton of performance > > improvement by dropping all of the semaphors for updates, dirty > > caches, etc. If you need the most recent version of the object, > > requery it and get on with life. > > > All of this suits databases with lower write and higher read ratios, > > but fortunately that's what I tend to work on. > > > On Jun 15, 7:07 am, Jan Goyvaerts <java.arti...@gmail.com> wrote: > > > No problem. We're not getting any younger, are we ? ;-) > > > > If I'm not mistaken it was one of the things about Scala being > > appreciated > > > by Java developers. Because it felt more natural to do this in Scala. > > > Something like that anyway. But I'll have to listening again to make > > sure. > > > > Traits ? Is it enough to add a trait to a class to make it JPA compliant > > ? > > > > On Wed, Jun 15, 2011 at 15:47, Dick Wall <dickw...@gmail.com> wrote: > > > > Gosh - Sorry Jan, I have absolutely no recollection of saying that, > > > > can someone give me a hint what my train of thought might have been. > > > > > I don't use JPA in Scala, as much as I liked it in Java. I use > > > > Squeryl, sometimes Querulous, and MongoDB whenever I can. I think > > > > traits can be a more natural way of mixing in persistence to a class > > > > than annotations (perhaps that's what I was thinking), but beyond that > > > > I can't imagine what I would have been thinking at the time :-). > > > > > Dick > > > > > On Jun 15, 2:37 am, Jan Goyvaerts <java.arti...@gmail.com> wrote: > > > > > In the aforementioned episode Dick talks about Scala being > > > > natural/intuitive > > > > > for object persistence. I assumed he meant using JPA with case > > classes. > > > > But > > > > > did he meant it that way ? In the last week I had various trials with > > > > mixed > > > > > success. I'd rather have case classes for their advantages but then > > > > there's > > > > > the tricky formatting of the annotations. > > > > > > Does anybody in here have a working example/doc of these > > Scala-natural > > > > > entities ? (case classes ? all in one file ? etc ...) > > > > > > My biggest frustration : I can't get the 2nd level caching working. > > I've > > > > > done this many times in Java. But Scala code resisted all my attempts > > so > > > > > far. Does anybody in here managed to enable the 2nd level cache ? > > Please > > > > ... > > > > > :-P > > > > > > Thanks ! > > > > > > Jan > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "The Java Posse" group. > > > > To post to this group, send email to javaposse@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > javaposse+unsubscr...@googlegroups.com. > > > > For more options, visit this group at > > > >http://groups.google.com/group/javaposse?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "The Java Posse" group. > > To post to this group, send email to javaposse@googlegroups.com. > > To unsubscribe from this group, send email to > > javaposse+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/javaposse?hl=en. -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javaposse@googlegroups.com. To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.