4 ms·
Hibernate is useful in one situation: you have a transaction that has to exist across actions taken by multiple disparate services, and you still need the conta
by mbell 14y ago
Hibernate is useful in one situation: you have a transaction that has to exist across actions taken by multiple disparate services, and you still need the container to manage this for you.
In my opinion, if your in that situation, you either have an application that is an edge case, or you've architected your application poorly.
My rule of thumb:
If it has the word 'enterprise' anywhere in it's name or description. Avoid it like the plague, only use it if its the last available option.
- babs474 14y agoCouldn't agree more about the enterprise sentiment. That is why I like things like Grails, that try and drag the enterprise java world, kicking and screaming into the modern era of ruby on rails style mvc and such. I think Grails mostly succeeds at this modernization, but I have to give fair warning that there are still some enterprisey bits (Spring, which isn't so bad and Hibernate, which will bite you) down in the guts. edit: Forgot to mention that Groovy is a fantastic, under-appreciated language with some neat features that should get more attention. Groovy is a major selling point for using Grails.
- mbell 14y agoI love groovy. Anytime I have something 'Java-JVM' that isn't performance critical, I write it in groovy. But even that mindset is falling away given the ability to use @CompileStatic. The best part of groovy to me is that I can use it where I want, when I want, with a single POM dependency and without (generally) having to think about how it interacts with existing Java code. When I write a Jersey controller, I start in java, if I hit a point where I'm thinking "this would be easier with a closure" or "defining an entire inner class here is stupid", I stop, change the file ending from .java to .groovy, and code away.
- vorg 14y ago> Anytime I have something 'Java-JVM' that isn't performance critical, I write it in groovy. But even that mindset is falling away given the ability to use @CompileStatic. The @CompileStatic-based static compilation in Groovy only began being written 1 year ago (in October 2011), and was only mature enough to be included in a production-ready version of Grails (version 2.2) a few weeks ago (December 2012). Scala has had static compilation from the very beginning, and was rewritten between Scala 1.x and Scala 2.x. Stick to dynamic typing if you're using Groovy, even stuff that isn't performance critical.