Friday, May 17, 2013

JSON Exposed Repositories & EclipseLink vs. Linq

There is a devilishly difficult pattern question in java architecture which is emerging as new deviceology throws us to the wolves of mobile devices and cloud beastments which is the ubiquitous need for json-able ORMs and AJAX feeders for data.  After three years pondering a hand hacked and painful repository pattern using hand squaged DAOs floating over Linq For Buggy Entities 3.5 and Linq for almost fixed Entities 4.0 that can now finally expose a property used in a link rather than force you to use a table trigger - I finally came to explore the tough patterns back in the java world which had gotten somewhat better but not completely.

So the first devil sausage says use the beatiful new JPA plugin which does visualization in Eclipse Juno to blast out your db tables and your entity beans then just slam some JSF and some pretty facets and UI wonders into the front end and blammo beaty and beauty for not much cost and time. To put darning on the socks EclipseLink will now also blast out all the JSON you need over rest for your AJAX calls.

But what if you chose the pure route - ditch the JSF and go straight HTML with Javascript and a boofy subslather like Knockout or Angular. Is this heresy to the java world? Moreover will you lose all the pretties that you get with something like PrimeFAces and other nice beasts?

It's a tough one. More and more JSF client workups seem dated and old. But on the other side if you've GOT the power of JSF why not use it. tough tough.

Things are changing as cloud and mobile demand robust ajax servers and tooling to spin json at a mile a minute. the question is can the developers keep up. You would think that after 100 years of this someone would set up a model centric framework that just blasts out all the rest for you. No not Roo. And not stuff that starts with clunky UML either.

In a way I kinda like the new graphical entity modeler in Eclipse. It's def the way to go. Now if they can just include the JAXB annotation properties and intelligent defaulting so you get BOTH XML, JSON and entities all keyed out right. Still it's miles ahead of Linq and .Net.