<?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>Martin Ahrer - Together we&#039;ll make IT &#187; Domain Driven Design</title>
	<atom:link href="http://www.martinahrer.at/tag/domain-driven-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.martinahrer.at</link>
	<description>Java Enterprise Softwareentwicklung und Consulting</description>
	<lastBuildDate>Sun, 11 Dec 2011 16:19:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<meta name="generator" content="deSignum 0.8.1" />
		<item>
		<title>Create reusable hibernate mappings</title>
		<link>http://www.martinahrer.at/2007/12/05/create-re-usable-hibernate-mappings/</link>
		<comments>http://www.martinahrer.at/2007/12/05/create-re-usable-hibernate-mappings/#comments</comments>
		<pubDate>Wed, 05 Dec 2007 10:09:43 +0000</pubDate>
		<dc:creator>Martin Ahrer</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Domain Driven Design]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/2007/12/05/create-re-usable-hibernate-mappings/</guid>
		<description><![CDATA[Complex mappings very often tend to result in repetitive mapping definitions especially when trying to apply concepts from Domain Driven Design. Value objects (value types as they are called by Hibernate) are a typical example for those kind of repetitive tasks. Let us assume that you want to keep track of user and time a [...]]]></description>
			<content:encoded><![CDATA[<p>Complex mappings very often tend to result in repetitive mapping definitions especially when trying to apply concepts from Domain Driven Design. Value objects (value types as they are called by Hibernate) are a typical example for  those kind of repetitive tasks.</p>
<p>Let us assume  that you want to keep track of user and time a set of entity types has been updated. So you would add a component mapping to all of the entity mappings where this feature is required.</p>
<pre lang="xml">
<component name="lastUpdate" class="domain.model.UserAccessReference">
<property name="at" type="date" column="UPDATE_TIME"></property>
<property name="by" column="UPDATE_USER_ID"></property>
</component></pre>
<p>This can get really tedious, so you might want to look for a more elegant solution that allows re-using this component mapping. Hibernate does not offer a mapping element that allows to include some externalized mapping fragment. But XML supports including XML documents through it&#8217;s DTD entity facility.</p>
<p>So you first start by moving the XML fragment that should be reusable to a file (e.g. domain/model/LastUpdate.xml)</p>
<pre lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<component name="lastUpdate" class="domain.model.UserAccessReference">
<property name="at" type="date" column="LAST_UPD" />
<property name="by" column="UPD_USR" />
</component></pre>
<p>For mapping file that requires the lastUpdate component an external ENTITY declaration must be added, the entity reference (&amp;lastUpdate;) is a place holder that is replaced by the entity.</p>
<pre lang="xml">
<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC
	"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
	"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
	[<!--ENTITY lastUpdate SYSTEM "classpath://domain/model/LastUpdate.hbm.xml"-->]>
<hibernate-mapping package="domain.model">
	<class table="TABLE" name="ClassName">
		<!-- some property mappings -->

		<!-- include the standard mapping for the lastUpdate property tuple -->
		&#038;lastUpdate;
	</class>
</hibernate-mapping></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2007/12/05/create-re-usable-hibernate-mappings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Started reading Domain Driven Design</title>
		<link>http://www.martinahrer.at/2007/06/18/started-reading-domain-driven-design/</link>
		<comments>http://www.martinahrer.at/2007/06/18/started-reading-domain-driven-design/#comments</comments>
		<pubDate>Mon, 18 Jun 2007 16:56:44 +0000</pubDate>
		<dc:creator>Martin Ahrer</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Domain Driven Design]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/?p=8</guid>
		<description><![CDATA[Today I started reading Eric Evans book about domain driven design which I feel is a must for any serious software engineer. A few quotes from chapter 2 which is mostly about a ubiquitous language: The vital detail about the design is captured on the code. About documents: A document shouldn&#8217; try to do what [...]]]></description>
			<content:encoded><![CDATA[<p>Today I started reading Eric Evans book about domain driven design which I feel is a must for any serious software engineer.</p>
<p><img src="http://domaindrivendesign.org/books/cover_small.jpg" /></p>
<p>A few quotes from chapter 2 which is mostly about a <em>ubiquitous language</em>:</p>
<blockquote><p>The vital detail about the design is captured on the code.</p></blockquote>
<p>About documents:</p>
<blockquote><p>A document shouldn&#8217; try to do what the code already does well.</p></blockquote>
<p>If documents are written at all (see Extreme Programming):</p>
<blockquote><p>Documents should work for a living and stay current (I have never been a friend of paper work!).</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2007/06/18/started-reading-domain-driven-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

