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>

Tuesday, April 10, 2012

Spring roo reverse engineering HSQL

When "database introspect --schema no-schema-required" after setting up a hsql db you may get "no driver class available".

Install the "wrapping" addon:

osgi install --url http://spring-roo-repository.springsource.org/release/org/springframework/roo/wrapping/org.springframework.roo.wrapping.hsqldb/1.8.0.10.0001/org.springframework.roo.wrapping.hsqldb-1.8.0.10.0001.jar