Earlier quoted context omitted.
JPA does have some gotchas and the learning curve is a little bit steep (not too steep, but just a wee bit). You do need to know how JPA works internally a little bit (e.g.: EntityManager actually cache your objects unless you tell it specifically to "flush").
My biggest problems with JPA: 1) CriteriaBuilder API is the worst API I've ever seen. I've never seen an API that turns a simple task into more lines of code than this monstrosity. I can't imagine many people use this thing, instead they use JPQL losing type safety in the process. 2) JPQL is still wildly verbose and very difficult to intertwine with native SQL. As an example try to generate something like "SELECT * F…
Build RESTful web services with Java technology
21–30 of 30 posts
Re: Build RESTful web services with Java technology
#22Earlier quoted context omitted.
JPA does have some gotchas and the learning curve is a little bit steep (not too steep, but just a wee bit). You do need to know how JPA works internally a little bit (e.g.: EntityManager actually cache your objects unless you tell it specifically to "flush").
My biggest problems with JPA: 1) CriteriaBuilder API is the worst API I've ever seen. I've never seen an API that turns a simple task into more lines of code than this monstrosity. I can't imagine many people use this thing, instead they use JPQL losing type safety in the process. 2) JPQL is still wildly verbose and very difficult to intertwine with native SQL. As an example try to generate something like "SELECT * F…
It's not great, but it's type safe. Having said that, I do C# so I just use Linq but before Linq I was using CriteriaBuilder. It wasn't so bad because I was only using it in specific repository objects, not all over the code.
Re: Build RESTful web services with Java technology
#23Re: Build RESTful web services with Java technology
#24Serious question: When did IBM/MSFT/"SOAP Vendors" start saying that REST is simpler?
Re: Build RESTful web services with Java technology
#25Building REST services with JAX-RS is truly pretty smooth and quick (I've been using Jersey not Wink though). One thing I don't ever recommend is using JPA based libraries (Hibernate, EclipseLink, whatever). Run screaming away from that spec as fast as you possibly can. There are much better options for ORMs in Java that don't have the session management headache and endless string of gotchas that is JPA. Ebean is my…
Re: Build RESTful web services with Java technology
#26Re: Build RESTful web services with Java technology
#27Earlier quoted context omitted.
Thanks a lot for the pointers. I have been looking for a good java framework to learn. I will be more than happy to settle with this 90% you quoted. They look simple enough to understand in a couple of days without wrestling with tons of XML config files.
If you're looking to write a backend service using Java, I would take a serious look at dropwizard http://dropwizard.codahale.com/ The get started page is not that long, and you should be able to kill it in a few hours. At the minimum you get http requests routed to methods and restful json parsed for you automatically. If you want, you can add optional configuration, metrics, healthcheck, logging, db access, views e…
Re: Build RESTful web services with Java technology
#28Building REST services with JAX-RS is truly pretty smooth and quick (I've been using Jersey not Wink though). One thing I don't ever recommend is using JPA based libraries (Hibernate, EclipseLink, whatever). Run screaming away from that spec as fast as you possibly can. There are much better options for ORMs in Java that don't have the session management headache and endless string of gotchas that is JPA. Ebean is my…
Re: Build RESTful web services with Java technology
#29Earlier quoted context omitted.
I prefer plain files instead of annotations. Just wish the non-readability of XML would go away with less bloated format (which other frameworks did with JSON).
Fair enough argument :) Though, now that I've gotten into the annotation way I like it the most.
:)
Re: Build RESTful web services with Java technology
#30Earlier quoted context omitted.
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 ha…