Monday, October 01, 2012

Auto create builder pattern code in eclipse

Looking at legacy code with lots of unwiedly constructors. Whilst mocking needing something to create all the boiler plate builder code and found this plugin that works with Juno too. http://code.google.com/p/bpep/

Saturday, May 19, 2012

Ignoring fields in JPA with xml mappings

You've got a xml file that you need to persist to the database and you don't really want to use low level parsing and jdbc.
  • Use trang to create a xml schema for the xml files
  • Use xjc to create the java objects
  • Use jpa with xml mapping to persist so there's no need to touch the generated source form xjc.  For fields you don't care about map them as transient.. e.g.
     <entity class="com.domain.xml_1_0.Site" access="FIELD">
              <attributes>
                   <transient name="siteInternalId"/>
                   <transient name="siteLinkage"/>
                   <id name="siteId"/>
              </attributes>
       </entity>