Build RESTful web services with Java technology
ibm.com
ibm.com
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 current favorite.
As for the "framework", I haven't really found the need for one. Jersey/Jackson + Jetty + Ebean gets you 90% of the way there, just fill in whatever you want for logging and other minor support items. If you want something more pre-packaged with some of the service start/stop boilerplate built in there is dropwizard (https://github.com/codahale/dropwizard).
In my case the Java backend exposes RESTful models via JSON which are consumed by a rails app using Her[0] a great gem that is what ActiveResource should have been. It wires up to Jersey quite easily.
However Spring using JSON as configuration format would be awesome :)
You can use annotation based configuration (meaning Java classes with annotations like @Configuration, @EnableWebMvc etc..) for > 90% of the configuration cases:
http://blog.springsource.org/2011/06/10/spring-3-1-m2-config...
Though, now that I've gotten into the annotation way I like it the most.
:)
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 etc.
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.
Though, I haven't taken a look and try at Ebean, and I will these days.
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").
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 * FROM `order` o ORDER BY RAND() LIMIT 5". That little call to RAND() makes generating this from JPA a huge pain.
3) Manual session life cycle management is terrible. It shouldn't be needed. This leads to all sorts of terrible hacks to get around it, ConversationScopes(CDI in general), opening transactions in the JSF RENDER_RESPONSE phase just so lazy loading works, etc, etc. Having used JavaEE stuff for awhile now I'm convinced a large portion of the cruft exists to support this model of session management. All the additional scopes and requisite CDI support seem to have all been created as workaround to just deal with session lifecycle.
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.
http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=A...
Besides the frontend code being much simpler (Javascript can do a lot of fancy stuff when it receives nicely structured data instead of dumb HTML) another huge benefit was enabling other people with different language backgrounds (Perl in my case) to perform their QA on the resulting API instead of manually clicking through the app (or writing quickly dying Selenium tests due to page modifications).
In the meantime even the customer does use the API for integration purposes using curl :)
Really happy with the latest developments...