Posts Tagged: purexml

Search for the XML Superstar

IDUG (the International DB2 Users Group) is sponsoring a worldwide contest initiative called The XML challenge – Search for the xml superstar. This contest aims to recognize developers (students or professionals) that create XML solutions, in one of the following categories: Video, Gadget, Query, PortableApp and XML Contest.

They are offering thousands of dollars in prizes, including Wiis, Zunes, iPods, Conference passes, Notebooks, GPS, etc…

If you live in US, you can submit your Video and Gadget entries until December 16th and 17th, respectively. The XML programming contest has also started and submissions will be accepted till January 31st.

For other countries, keep checking the website xmlchallenge.com for updates on your local contest.

Persisting XML with OpenJPA

I’ve been looking at JPA – Java Persistence Architecture and decided to play a bit with OpenJPA using DB2 as the back-end. My goal: to persist and query XML data in DB2, making use of DB2’s pureXML capabilities to query the XML data using SQL/XML‘s XMLQUERY() function.

However, while OpenJPA has an extensive documentation, the examples are not always complete and there isn’t a lot of information on the web regarding OpenJPA error determination and solving. So, here are some recommendations for some of the problems I have encountered. The class xml.Address is the one to be persisted as XML in the database using JPA and it is stored as the field shipAddress of the Order objects.

 [java] Exception in thread "main" <openjpa-1.0.0-r420667:568756 fatal user error>
org.apache.openjpa.persistence.ArgumentException:
Type "class xml.Address" does not have persistence metadata. 

Suggestion: Remove the reference to xml.Address from persistence.xml

[java] Exception in thread "main" <openjpa-1.0.0-r420667:568756 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException:
Encountered unmanaged object "xml.Address@9b2a51" in
persistent field "xml.Order.shipAddress" of managed object "xml.Order@12b3349"
during flush.  However, this field does not allow cascade persist. 
You cannot flush unmanaged objects.
  [java] FailedObject: xml.Address@9b2a51

Suggestion: Make sure you have no @Entity or @Embeddable annotations in xml.Address. The main annotation is @XmlRootElement.

 [java] Exception in thread "main" <openjpa-1.0.0-r420667:568756 fatal general error>
org.apache.openjpa.persistence.PersistenceException:
"xml" doesnt contain ObjectFactory.class or jaxb.index

Suggestion: add a file jaxb.index into your xml package containing all the classes to be persisted as XML: a file containing Address in our case.

DB2 on Rails update

I’m back to fiddling around with my Ruby on Rails experiments(1)(2). I was able to create a very useful 2-way mapping between Ruby objects and xml data stored in DB2 pureXML. Basically, trying to replicate some of ActiveRecord’s functionality but for XML data. I still find it odd, though, that both ROXML and xml-mapping haven’t had much activity as of late. I’m wondering if there is any new OXM library around that I don’t know of.

Also on the same topic:

  • the main DB2 on Rails website is up and running again, with a revamped design and now using wordpress instead of typo.
  • a new version of the ibm_db driver was also released, containing several bugfixes. Update it through gems (gem update ibm_db) or from here: http://rubyforge.org/projects/rubyibm/ 

XML and Databases

I just stumbled across an excellent resource regarding XML technology in databases. Ronald Bourret has the most extensive research I’ve seen on the global XML and databases state of the art. It has an extensive list of databases with XML support (native or by means of extenders/adapters) recently updated and several papers on XML and databases

A must read, that I will be consuming over the coming weeks. 

CASCON 2006

CASCON 2006 wil take place from October 16 to October 19, in Toronto, Canada. 

"CASCON 2006 is the 16th in the Annual International Conference hosted
by the IBM Centers for Advanced Studies. This "Meeting of Minds"
provides an exciting forum for exchanging ideas and experiences in the
ever-expanding and critical fields of software development and
computing."

I will be presenting at CASCON, doing both a workshop and a technology showcase. Both sessions will be about the same subject: DB2 9 and it’s pureXMLâ„¢ features.