<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vitor Rodrigues &#187; mapping</title>
	<atom:link href="http://www.vitorrodrigues.com/blog/tag/mapping/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vitorrodrigues.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 28 Sep 2009 18:05:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Persisting XML with OpenJPA</title>
		<link>http://www.vitorrodrigues.com/blog/2007/10/23/persisting-xml-in-openjpa/</link>
		<comments>http://www.vitorrodrigues.com/blog/2007/10/23/persisting-xml-in-openjpa/#comments</comments>
		<pubDate>Tue, 23 Oct 2007 18:15:46 +0000</pubDate>
		<dc:creator>vitor</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[db2]]></category>
		<category><![CDATA[db2express-c]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[openjpa]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[purexml]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.vitorrodrigues.com/blog/2007/10/23/persisting-xml-in-openjpa/</guid>
		<description><![CDATA[I&#8217;ve been looking at JPA &#8211; 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&#8242;s pureXML capabilities to query the XML data using SQL/XML&#8216;s XMLQUERY() function. However, while OpenJPA has an extensive documentation, the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking at <a href="http://java.sun.com/javaee/overview/faq/persistence.jsp">JPA &#8211; Java Persistence Architecture</a> and decided to play a bit with <a href="http://openjpa.apache.org">OpenJPA </a>using <a href="http://www.ibm.com/db2/express">DB2 </a>as the back-end. My goal: to persist and query XML data in DB2, making use of DB2&#8242;s <a href="http://www.ibm.com/software/data/db2/9/editions_features_purexml.html%20">pureXML </a>capabilities to query the XML data using <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=35341">SQL/XML</a>&#8216;s XMLQUERY() function.
</p>
<p>However, while OpenJPA has an <a href="http://openjpa.apache.org/docs/latest/manual/manual.html">extensive documentation</a>, the examples are not always complete and there isn&#8217;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 <em>xml.Addres</em>s is the one to be persisted as XML in the database using JPA and it is stored as the field <em>shipAddress </em>of the <em>Order </em>objects.<br />
  
</p>
<pre> [java] Exception in thread "main" &lt;openjpa-1.0.0-r420667:568756 fatal user error&gt;
org.apache.openjpa.persistence.ArgumentException:
Type "class xml.Address" does not have persistence metadata.&nbsp;
</pre>
<p><strong>Suggestion:</strong> Remove the reference to <em>xml.Address</em> from <em>persistence.xml</em>.&nbsp;
</p>
<pre>[java] Exception in thread "main" &lt;openjpa-1.0.0-r420667:568756 nonfatal user error&gt;
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.&nbsp; However, this field does not allow cascade persist.&nbsp;
You cannot flush unmanaged objects.
  [java] FailedObject: xml.Address@9b2a51
</pre>
<p><strong>Suggestion</strong><strong>:</strong> Make sure you have no <em>@Entity</em> or <em>@Embeddable</em> annotations in <em>xml.Address</em>. The main annotation is <em>@XmlRootElement</em>.
</p>
<pre> [java] Exception in thread "main" &lt;openjpa-1.0.0-r420667:568756 fatal general error&gt;
org.apache.openjpa.persistence.PersistenceException:
"xml" doesnt contain ObjectFactory.class or jaxb.index
</pre>
<p><strong>Suggestion</strong><strong>:</strong> add a file <em>jaxb.index</em> into your <em>xml </em>package containing all the classes to be persisted as XML: a file containing <em>Address</em> in our case.</p>
<img src="http://www.vitorrodrigues.com/blog/?ak_action=api_record_view&id=116&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.vitorrodrigues.com/blog/2007/10/23/persisting-xml-in-openjpa/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>DB2 on Rails update</title>
		<link>http://www.vitorrodrigues.com/blog/2007/10/17/db2-on-rails-update/</link>
		<comments>http://www.vitorrodrigues.com/blog/2007/10/17/db2-on-rails-update/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 20:45:35 +0000</pubDate>
		<dc:creator>vitor</dc:creator>
				<category><![CDATA[DB2 pureXML]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[db2]]></category>
		<category><![CDATA[db2onrails]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[oxm]]></category>
		<category><![CDATA[purexml]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ror]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.vitorrodrigues.com/blog/2007/10/17/db2-on-rails-update/</guid>
		<description><![CDATA[I&#8217;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&#8217;s functionality but for XML data. I still find it odd, though, that both ROXML and xml-mapping haven&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m back to fiddling around with my Ruby on Rails experiments(<a href="http://www.vitorrodrigues.com/blog/2007/06/13/ruby-libxml-annoyances/">1</a>)(<a href="http://www.vitorrodrigues.com/blog/2007/07/05/xml-mapping-in-ruby/">2</a>). 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&#8217;s functionality but for XML data. I still find it odd, though, that both <a href="http://roxml.rubyforge.org">ROXML </a>and <a href="http://xml-mapping.rubyforge.org/">xml-mapping</a> haven&#8217;t had much activity as of late. I&#8217;m wondering if there is any new OXM library around that I don&#8217;t know of.<br />
  
</p>
<p>Also on the same topic:
</p>
<ul>
<li>the main <a href="http://db2onrails.com/">DB2 on Rails</a> website is up and running again, with a revamped design and now using wordpress instead of typo.</li>
<li>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/&nbsp;</li>
</ul>
<img src="http://www.vitorrodrigues.com/blog/?ak_action=api_record_view&id=114&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.vitorrodrigues.com/blog/2007/10/17/db2-on-rails-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML Mapping in Ruby</title>
		<link>http://www.vitorrodrigues.com/blog/2007/07/05/xml-mapping-in-ruby/</link>
		<comments>http://www.vitorrodrigues.com/blog/2007/07/05/xml-mapping-in-ruby/#comments</comments>
		<pubDate>Thu, 05 Jul 2007 16:34:07 +0000</pubDate>
		<dc:creator>vitor</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[aptana]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.vitorrodrigues.com/blog/2007/07/05/xml-mapping-in-ruby/</guid>
		<description><![CDATA[Dear lazy web&#8230; I&#8217;ve been playing with Ruby and XML lately, and one of the key features I need to use is XML mapping from XML to Ruby objects and vice versa. However, both ROXML and XML::Mapping do not seem to be very active at the moment. Both forums contain un-replied questions&#160; several months old, [...]]]></description>
			<content:encoded><![CDATA[<p>Dear lazy web&#8230;
</p>
<p>I&#8217;ve been playing with Ruby and XML lately, and one of the key features I need to use is XML mapping from XML to Ruby objects and vice versa. However, both <a href="http://roxml.rubyforge.org">ROXML </a>and <a href="http://xml-mapping.rubyforge.org">XML::Mapping</a> do not seem to be very active at the moment. Both forums contain un-replied questions&nbsp; several months old, and I can&#8217;t find any examples that are not a couple of years old.
</p>
<p>Is there any XML Mapping library for Ruby that is currently active(*)? XML::Mapping was serving me good enough, until the moment that I needed some of the <a href="http://xml-mapping.rubyforge.org/files/README.html#choice_node">documented features</a> and found that they are not supported in the current release <img src='http://www.vitorrodrigues.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />
</p>
<p>&nbsp;(*) by active I don&#8217;t mean it needs to be in exclusively in code development, but at least with some recent activity in forums, documentation, examples, etc..
</p>
<p>
  </p>
<img src="http://www.vitorrodrigues.com/blog/?ak_action=api_record_view&id=96&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.vitorrodrigues.com/blog/2007/07/05/xml-mapping-in-ruby/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

