<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Glen Smith (Java Related category)</title>
  <link rel="alternate" href="http://blogs.bytecode.com.au:80/categories/Java" />
  <subtitle>Glen Smith (Java Related category)</subtitle>
  <entry>
    <title>From WSDL to JAXB to JPA with a single schema: Adventures in Hyperjaxb3</title>
    <link rel="alternate" href="http://blogs.bytecode.com.au:80/glen/2010/07/29/from-wsdl-to-jaxb-to-jpa-with-a-single-schema--adventures-in-hyperjaxb3.html" />
    <author>
      <name />
    </author>
    <updated>2010-07-29T09:58:00Z</updated>
    <published>2010-07-29T09:58:00Z</published>
    <summary type="html">&lt;p&gt;&#xD;
The client brief was pretty straightforward: "We need to persist this class to a Database". No problem. Hibernate FTW. "Actually, we'd like to use JPA2 to do the heavy lifting". No problem, we'll annotate up the domain classes with a few @Entity statements and we're off. "Oh, and the class we wish to persist is a graph of objects that are dynamically generated via JAXB". Things are getting a little more complex now.&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Converting your WSDL into a set of JAXB classes is super simple: Use your IDE or the very cool &lt;a href="https://maven-jaxb2-plugin.dev.java.net/"&gt;Maven Plugin&lt;/a&gt; to get you up and running. But annotating those generated classes with JPA annotations on the way through? That's a little trickier. Fortunately wsimport just invokes the JAXB compiler (xjc) under the cover, and xjc support plugins! You know where we're going here..&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Enter &lt;a href="https://hyperjaxb3.dev.java.net/"&gt;hyperjaxb3&lt;/a&gt;. This very slick little library provides an xjc plugin to markup your JAXB classes with JPA annotations. It will even generate your persistence.xml file on the way through. Most importantly of all, it knows how to work around the &lt;a href="http://confluence.highsource.org/display/HJ3/JAXB+vs.+JPA"&gt;known incompatibilities&lt;/a&gt; between JPA and JAXB (for example, that your xsd:date entries will get marshalled to javax.xml.datatype.XMLGregorianCalendar which is not a supported type for JPA). &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Hyperjaxb3 works around things like this by providing @Transient getters and setters for the XMLGregorianCalendar methods, whilst generating native JPA getters and setter for standard java.util.Date classes. Very tricky.&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Hyperjaxb will also handle collections cleverly, so List&lt;String&gt; gets marshalled off into its own 1:m table. It means that complex graphs will generate lots of tables, but everything worked for my prototype which was a very complex schema. I'm super impressed. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
It took several days to get all the dependencies right, and it did involve copying jaxb and jaxws jars into my jdk1.6.0/jre/lib/endorsed folder - so I thought I'd put up a sample POM below to save you some time. I'm not sure that the approach is even going to work under scale, given the complexity of the graph. I suspect we'd be better off writing a simple JPA wrapper class that we marshall via &lt;a href="http://dozer.sourceforge.net/"&gt;Dozer&lt;/a&gt; but it does give the client their preferred option to explore.&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
To save you some time, I'll provide a &lt;a href="images/2010/pom.xml"&gt;Sample Maven POM&lt;/a&gt; that is wired up for everything you need to get yourself up and running. Just add your favorite IDE and you're in business. Oh, and don't forget that /jre/lib/endorsed thing. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Happy transformations!&#xD;
&lt;/p</summary>
    <dc:date>2010-07-29T09:58:00Z</dc:date>
  </entry>
  <entry>
    <title>My "NoSQL for Java Devs" slides are now online</title>
    <link rel="alternate" href="http://blogs.bytecode.com.au:80/glen/2010/07/15/my--nosql-for-java-devs--slides-are-now-online.html" />
    <author>
      <name />
    </author>
    <updated>2010-07-14T23:53:00Z</updated>
    <published>2010-07-14T23:53:00Z</published>
    <summary type="html">&lt;p&gt;&#xD;
Had a fantastic time last night with the guys at my local &lt;a href="http://www.cjugaustralia.org"&gt;Canberra JUG&lt;/a&gt; giving a presentation titled "NoSQL - Life Beyond the Outer Join". I'll embed the slides further down.&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
In the talk we looked at four different types of NoSQL options for Java guys: Simple Key/Value in-memory stores (&lt;a href="http://memcached.org/"&gt;Memcached&lt;/a&gt;), sophisticated distributed key/value stores (&lt;a href="http://project-voldemort.com/"&gt;Voldemort&lt;/a&gt;), Document Databases (&lt;a href="http://couchdb.apache.org/"&gt;CouchDB&lt;/a&gt;), and Graph Databases (&lt;a href="http://neo4j.org/"&gt;Neo4j&lt;/a&gt;). &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
We also had a play with the common java clients that are used to access them: &lt;a href="http://code.google.com/p/spymemcached/"&gt;Spy&lt;/a&gt; for Memcached, &lt;a href="http://code.google.com/p/ektorp/"&gt;Ektorp&lt;/a&gt; for CouchDb, and the bundled libs for Neo4j and Voldemort. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
I've put all the source up on a &lt;a href="http://bitbucket.org/glen_a_smith/cjug-nosql-examples"&gt;Bitbucket Project&lt;/a&gt; which you can clone. It's all Mavenized, so you can knock yourself out with whatever IDE works for you. If you're on Windows, I've also included links to the download pages of the various servers on the BitBucket &lt;a href="http://bitbucket.org/glen_a_smith/cjug-nosql-examples/wiki/Home"&gt;Wiki Page&lt;/a&gt; for the project. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
&lt;div style="width:425px" id="__ss_4756894"&gt;&lt;strong style="display:block;margin:12px 0 4px"&gt;&lt;a href="http://www.slideshare.net/glen_a_smith/nosql-life-beyond-the-outer-join" title="NoSQL - Life Beyond the Outer Join"&gt;NoSQL - Life Beyond the Outer Join&lt;/a&gt;&lt;/strong&gt;&lt;object id="__sse4756894" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=nosql-lifebeyondtheouterjoin-100714183210-phpapp02&amp;stripped_title=nosql-life-beyond-the-outer-join" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;embed name="__sse4756894" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=nosql-lifebeyondtheouterjoin-100714183210-phpapp02&amp;stripped_title=nosql-life-beyond-the-outer-join" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="padding:5px 0 12px"&gt;View more &lt;a href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a href="http://www.slideshare.net/glen_a_smith"&gt;glen_a_smith&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Thanks to the bunch of folk that turned up on the night. It was great crowd full of interesting questions and discussions!&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Happy NoSQLing!&#xD;
&lt;/p&gt;</summary>
    <dc:date>2010-07-14T23:53:00Z</dc:date>
  </entry>
  <entry>
    <title>Netbeans and solving the dreaded "unrecognized project; missing plug-in?"</title>
    <link rel="alternate" href="http://blogs.bytecode.com.au:80/glen/2010/07/03/netbeans-and-solving-the-dreaded--unrecognized-project--missing-plug-in--.html" />
    <author>
      <name />
    </author>
    <updated>2010-07-02T22:54:00Z</updated>
    <published>2010-07-02T22:54:00Z</published>
    <summary type="html">&lt;p&gt;&#xD;
I has recently handed a truckload of client code all developed in Netbeans. In order to get a feel for the interdependencies, I thought I just fire up a clean copy of Netbeans and open it up. Unfortunately, when I tried to open the project I was greeted with the dreaded "unrecognized project; missing plug-in" dialog:&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
&lt;img src="images/2010/unrecognized-project-missing-plugin.gif" alt="Unrecognised project; missing plugin"/&gt;&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Hmnmm... That's ok, so I thought I'd just open it up as a "free-form" Netbeans project, but that's no good either, since Netbeans complains that it's already a Netbeans project! After a bunch of mucking around, I found out the problem, I was missing a plugin! But which one? &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
If you open up the nbproject/project.xml file will have something like this:&#xD;
&lt;/p&gt;&#xD;
&lt;pre class="prettyprint"&gt;&#xD;
&lt;project xmlns="http://www.netbeans.org/ns/project/1"&gt;&#xD;
    &lt;type&gt;org.netbeans.modules.j2ee.earproject&lt;/type&gt;&#xD;
     ...&#xD;
&lt;/project&gt;&#xD;
&lt;/pre&gt;&#xD;
&lt;p&gt;&#xD;
So that &lt;code&gt;type&lt;/code&gt; element gives you the skinny. In this case I was missing the EAR project plugin. Once that was installed, the project opened up just fine. Thought I'd blog it up to save you some google time down the track.&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Happy recognised projects!&#xD;
&lt;/p&gt;</summary>
    <dc:date>2010-07-02T22:54:00Z</dc:date>
  </entry>
  <entry>
    <title>Canberra JUG Talk: NoSQL - Life after the Outer Join</title>
    <link rel="alternate" href="http://blogs.bytecode.com.au:80/glen/2010/06/28/canberra-jug-talk--nosql---life-after-the-outer-join.html" />
    <author>
      <name />
    </author>
    <updated>2010-06-28T01:05:00Z</updated>
    <published>2010-06-28T01:05:00Z</published>
    <summary type="html">&lt;p&gt;&#xD;
Next month I'll be hanging out at my &lt;a href="http://www.cjugaustralia.org"&gt;local JUG&lt;/a&gt; giving a bit of a survey of the main players in the NoSQL movement along with the Java APIs that they offer. If you're in or around Canberra on July 14, make sure drop by for a great night of Pizza and Java Geekery with a somewhat schemaless design ;-) &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Will slideshare up the slides, and bitbucket up the source, once I've done the presento. Till then, here's the blurb for the night:&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
&lt;b&gt;Abstract&lt;/b&gt;&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
The NoSQL (Not Only SQL) movement has been gaining a lot of press over the last year as a means of scaling massive data storage, complex relationships and lightening fast retrieval for the Web's biggest sites. This month we're taking a trip to the big end of town and looking at some of the backend technologies that are powering sites like Twitter, Facebook, LinkedIn, Reddit, Digg and Google. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
We'll be looking at popular Java clients and servers that play in the NoSQL space and have a brief survey of the following popular NoSQL platforms: Document Databases (&lt;a href="http://www.mongodb.org/"&gt;MongoDB&lt;/a&gt;/&lt;a href="http://couchdb.apache.org/"&gt;CouchDB&lt;/a&gt;), Sophisticated Key/Value Stores (&lt;a href="http://cassandra.apache.org/"&gt;Cassandra&lt;/a&gt;), Graph Databases (&lt;a href="http://neo4j.org/"&gt;Neo4j&lt;/a&gt;), and simple Key/Value stores (&lt;a href="http://memcached.org/"&gt;Memcached&lt;/a&gt;). It'l be a lightening tour of what each technology offers, some source code on how it works, and lots of headshifts about how to store data such that you don't ever need another Left Outer Join!&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
We'll have a lot of fun, you'll pick up a bunch of new buzzwords to impress your peers, and you can take the source away and play at home. Put it in your diary now!&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
&lt;b&gt;About Glen&lt;/b&gt;&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Glen is a hardcore Java trainer and speaker, co-author of &lt;a href="http://www.manning.com/gsmith/"&gt;Grails in Action&lt;/a&gt; from Manning, co-host of the &lt;a href="http://grailspodcast.com"&gt;Grails Podcast&lt;/a&gt; and a former winner of Australian Masterchef. He blogs at &lt;a href="http://blogs.bytecode.com.au/glen"&gt;http://blogs.bytecode.com.au/glen&lt;/a&gt; and Twitters at &lt;a href="http://www.twitter.com/glen_a_smith"&gt;http://www.twitter.com/glen_a_smith&lt;/a&gt;. &#xD;
&#xD;
&lt;/p&gt;</summary>
    <dc:date>2010-06-28T01:05:00Z</dc:date>
  </entry>
  <entry>
    <title>Hacking your first Air application</title>
    <link rel="alternate" href="http://blogs.bytecode.com.au:80/glen/2010/05/05/hacking-your-first-air-application.html" />
    <author>
      <name />
    </author>
    <updated>2010-05-05T11:27:00Z</updated>
    <published>2010-05-05T11:27:00Z</published>
    <summary type="html">&lt;p&gt;&#xD;
I've recently been developing some concepts for a client that needed to be a cross-platform rich client app. By nature I'm a Java guy, but because of the target environment, getting a JRE on the target platform was going to be problematic. So we were looking into other cross-platform alternatives, and the install/update experience with Air seemed to fit the bill (I would *love* to be doing it in &lt;a href="http://griffon.codehaus.org/"&gt;Griffon&lt;/a&gt;, but the JRE install experience is just too clumsy for our target - hopefully Oracle will fix that in v7!).&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
The platform is really easy to get productive on. You can write Air apps in Flash or Flex or just plain old HTML/CSS/Javascript/jQuery. If you choose the html route, there's very few new skills to learn and you'll have bundled up your first app within a few minutes of getting started. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
You have a known Webkit engine bundled with Air, so there's no special html/css/js hackarounds required - and you can just use good old jQuery for your interaction magic. Even the install badge generation and automated update experience is super easy to get going. The developer experience is fantastic. They've really done some good thinking here.&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
So how do you get started with Air? Here's a few jump points that I've collected to get you started:&#xD;
&lt;/p&gt;&#xD;
&lt;ul&gt;&#xD;
&lt;li&gt;Download the free &lt;a href="http://www.aptana.org/air/"&gt;Aptana Studio&lt;/a&gt; Eclipse plugin (or standalone app if you're not an Eclipse kinda guy).&#xD;
&lt;li&gt;Checkout the &lt;a href="http://articles.sitepoint.com/print/adobe-air-todo-list-5-minutes"&gt;Create an AIR TODO list in 5 minutes&lt;/a&gt; tutorial over on Sitepoint.&#xD;
&lt;li&gt;Have a look around the &lt;a href="http://www.adobe.com/devnet/air/ajax/"&gt;Adobe AIR with Javascript&lt;/a&gt; site for the API refs&#xD;
&lt;/ul&gt;&#xD;
&lt;p&gt;&#xD;
I've found Aptana studio to be a fantastic way to which up and run prototypes from directly within the IDE. The plugin also gives you  a new /Export/AIR Application option from Eclipse which makes the bundling of your .air file very straightforward&#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
As for supporting books? I bought the ebook for &lt;a href="http://oreilly.com/catalog/9780596522513"&gt;Adobe AIR 1.5 Cookbook&lt;/a&gt; and it has been a fantastic resource. It gives almost all the cookbook examples in both Flex and Javascript so you can quickly take advantage of lots of the common operations (tray integration, start on logon, custom window shapes, etc). I've really enjoyed it and found it an awesome reference. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
You can also download an older title which is completely free called &lt;a href="http://ajaxian.com/archives/adobe-air-for-javascript-developers-pocketguide"&gt;Adobe Air for Javascript Developers Pocket Guide&lt;/a&gt;. A much smaller title which gives you a good taste for the platform none-the-less. &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Anyways, I'm having a fantastic time with Air and have found the learning curve (using the HTML/Javascript model) to be extremely straightforward - productive from day one. I'll report back on the Air front once our app actually goes live for the client. It's a Government initiative, so there'll be lots of press when the launch happens! &#xD;
&lt;/p&gt;&#xD;
&lt;p&gt;&#xD;
Can't wait to play with some options for a Grails backend that fronts an Air client. It's definitely on my list!&#xD;
&lt;/p&gt;</summary>
    <dc:date>2010-05-05T11:27:00Z</dc:date>
  </entry>
</feed>

