<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Mapping MultiMaps with Hibernate</title>
	<atom:link href="http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/</link>
	<description>Software development done right!</description>
	<lastBuildDate>Wed, 08 Feb 2012 14:41:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Mark</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-106898</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 13 Jul 2011 07:58:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-106898</guid>
		<description>Hi,

Thanks for this, it&#039;s been very useful. However, MultiMap.putAll doesn&#039;t work with the above code (it uses the existing PersistentMap.putAll  that puts the value collections into the MultiMap rather than each key, value pair). The following works for me if added to PersistentMultiMap:

	/**
	 * @see java.util.Map#putAll(java.util.Map puts)
	 */
	@Override
	public void putAll(Map puts) {
		if ( puts.size()&gt;0 ) {
			initialize( true );
			Iterator itr = puts.entrySet().iterator();
			while ( itr.hasNext() ) {
				Map.Entry entry = ( Entry ) itr.next();
				Collection collection = (Collection) entry.getValue();
				for( Object value : collection) {
					put( entry.getKey(), value );
					}
			}
		}
	}</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for this, it&#8217;s been very useful. However, MultiMap.putAll doesn&#8217;t work with the above code (it uses the existing PersistentMap.putAll  that puts the value collections into the MultiMap rather than each key, value pair). The following works for me if added to PersistentMultiMap:</p>
<p>	/**<br />
	 * @see java.util.Map#putAll(java.util.Map puts)<br />
	 */<br />
	@Override<br />
	public void putAll(Map puts) {<br />
		if ( puts.size()&gt;0 ) {<br />
			initialize( true );<br />
			Iterator itr = puts.entrySet().iterator();<br />
			while ( itr.hasNext() ) {<br />
				Map.Entry entry = ( Entry ) itr.next();<br />
				Collection collection = (Collection) entry.getValue();<br />
				for( Object value : collection) {<br />
					put( entry.getKey(), value );<br />
					}<br />
			}<br />
		}<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-94169</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Thu, 18 Feb 2010 21:20:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-94169</guid>
		<description>Has anyone tried this with Maps ie: Map&lt;key, Map&gt;?  I&#039;ve been able to get Map&lt;key, List&gt; to work but would like to get the above to work as well.  Any ideas?</description>
		<content:encoded><![CDATA[<p>Has anyone tried this with Maps ie: Map&lt;key, Map&gt;?  I&#8217;ve been able to get Map&lt;key, List&gt; to work but would like to get the above to work as well.  Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-93513</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Tue, 15 Dec 2009 22:28:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-93513</guid>
		<description>Can anybody tell me how to use a java.lang.Integer as the mapped type, rather than some user-defined class?</description>
		<content:encoded><![CDATA[<p>Can anybody tell me how to use a java.lang.Integer as the mapped type, rather than some user-defined class?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prabu</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-91536</link>
		<dc:creator>prabu</dc:creator>
		<pubDate>Wed, 15 Apr 2009 06:14:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-91536</guid>
		<description>Sorry the xml is ignored coz of spl chars
Here it is..


&lt;class&gt;
    ....
    &lt;map name=&quot;acl&quot; table=&quot;GROUP_OBJECTS&quot; cascade=&quot;save-update,delete&quot; collection-type=&quot;MultiMapType&quot;&gt;
        &lt;key column=&quot;GROUPID&quot; /&gt;
        &lt;map-key column=&quot;OBJECTTYPEID&quot; type=&quot;objectType&quot;/&gt;            
        &lt;one-to-many class=&quot;AclObject&quot; /&gt;
    &lt;/map&gt;
&lt;/class&gt;


&lt;class name=&quot;AclObject&quot;	table=&quot;GROUP_OBJECTS&quot; lazy=&quot;false&quot;&gt;

    &lt;id name=&quot;id&quot; column=&quot;ID&quot; type=&quot;java.lang.Integer&quot;&gt;
        &lt;generator class=&quot;increment&quot;/&gt;
    &lt;/id&gt;
        
    &lt;property name=&quot;groupId&quot; column=&quot;USERGROUPID&quot; type=&quot;java.lang.Integer&quot; not-null=&quot;true&quot;/&gt;

    &lt;property name=&quot;objectType&quot; column=&quot;OBJECTTYPEID&quot; type=&quot;objectType&quot;	not-null=&quot;true&quot;/&gt;

    &lt;property name=&quot;objectId&quot; column=&quot;OBJECTID&quot; type=&quot;java.lang.String&quot;	not-null=&quot;true&quot;/&gt;   

&lt;/class&gt;</description>
		<content:encoded><![CDATA[<p>Sorry the xml is ignored coz of spl chars<br />
Here it is..</p>
<p>&lt;class&gt;<br />
    &#8230;.<br />
    &lt;map name=&#8221;acl&#8221; table=&#8221;GROUP_OBJECTS&#8221; cascade=&#8221;save-update,delete&#8221; collection-type=&#8221;MultiMapType&#8221;&gt;<br />
        &lt;key column=&#8221;GROUPID&#8221; /&gt;<br />
        &lt;map-key column=&#8221;OBJECTTYPEID&#8221; type=&#8221;objectType&#8221;/&gt;<br />
        &lt;one-to-many class=&#8221;AclObject&#8221; /&gt;<br />
    &lt;/map&gt;<br />
&lt;/class&gt;</p>
<p>&lt;class name=&#8221;AclObject&#8221;	table=&#8221;GROUP_OBJECTS&#8221; lazy=&#8221;false&#8221;&gt;</p>
<p>    &lt;id name=&#8221;id&#8221; column=&#8221;ID&#8221; type=&#8221;java.lang.Integer&#8221;&gt;<br />
        &lt;generator class=&#8221;increment&#8221;/&gt;<br />
    &lt;/id&gt;</p>
<p>    &lt;property name=&#8221;groupId&#8221; column=&#8221;USERGROUPID&#8221; type=&#8221;java.lang.Integer&#8221; not-null=&#8221;true&#8221;/&gt;</p>
<p>    &lt;property name=&#8221;objectType&#8221; column=&#8221;OBJECTTYPEID&#8221; type=&#8221;objectType&#8221;	not-null=&#8221;true&#8221;/&gt;</p>
<p>    &lt;property name=&#8221;objectId&#8221; column=&#8221;OBJECTID&#8221; type=&#8221;java.lang.String&#8221;	not-null=&#8221;true&#8221;/&gt;   </p>
<p>&lt;/class&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prabu</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-91535</link>
		<dc:creator>prabu</dc:creator>
		<pubDate>Wed, 15 Apr 2009 06:09:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-91535</guid>
		<description>Hi,

I tried the Map of Sets solution.
See below for the mapping. In spite of cascade option set the AclObject is not geting saved and
i get the following errors
&quot;object references an unsaved transient instance - save the transient instance before flushing&quot;

Any pointers would be of great help

Thanks


    ....
    
        
                    
        
    





    
        
    
        
    

    

       

</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I tried the Map of Sets solution.<br />
See below for the mapping. In spite of cascade option set the AclObject is not geting saved and<br />
i get the following errors<br />
&#8220;object references an unsaved transient instance &#8211; save the transient instance before flushing&#8221;</p>
<p>Any pointers would be of great help</p>
<p>Thanks</p>
<p>    &#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-82723</link>
		<dc:creator>Pat</dc:creator>
		<pubDate>Fri, 13 Feb 2009 20:08:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-82723</guid>
		<description>(Additional comment)

You say that Map&lt;string, list&gt; cannot be handled, but then you prove that it can be. After all a list can be considered TreeMap This is actually better in hibernate than a regular list because:

 * sparse lists are now possible
 * the element indicies as storied in the db can have gaps to allow inserting new elements without renumbering all elements.</description>
		<content:encoded><![CDATA[<p>(Additional comment)</p>
<p>You say that Map&lt;string, list&gt; cannot be handled, but then you prove that it can be. After all a list can be considered TreeMap This is actually better in hibernate than a regular list because:</p>
<p> * sparse lists are now possible<br />
 * the element indicies as storied in the db can have gaps to allow inserting new elements without renumbering all elements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-82716</link>
		<dc:creator>Pat</dc:creator>
		<pubDate>Fri, 13 Feb 2009 19:53:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-82716</guid>
		<description>This seems so generally useful that it should be part of the standard hibernate package.</description>
		<content:encoded><![CDATA[<p>This seems so generally useful that it should be part of the standard hibernate package.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maarten Winkels</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-44761</link>
		<dc:creator>Maarten Winkels</dc:creator>
		<pubDate>Tue, 03 Jun 2008 20:16:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-44761</guid>
		<description>Unfortunately, the attachements to this blog have been lost. The complete source code of the (2) classes needed for the mechanism described in this blog are included in the text of the blog.
To use the code, simply cut and paste the classes together.

Regards,

Maarten Winkels</description>
		<content:encoded><![CDATA[<p>Unfortunately, the attachements to this blog have been lost. The complete source code of the (2) classes needed for the mechanism described in this blog are included in the text of the blog.<br />
To use the code, simply cut and paste the classes together.</p>
<p>Regards,</p>
<p>Maarten Winkels</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nfeybesse</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-44346</link>
		<dc:creator>nfeybesse</dc:creator>
		<pubDate>Thu, 08 May 2008 08:17:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-44346</guid>
		<description>Hi,

Yes, 

It will be very nice if you could attach the source files of this enhancement ! 

Thanks
Nicolas</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Yes, </p>
<p>It will be very nice if you could attach the source files of this enhancement ! </p>
<p>Thanks<br />
Nicolas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicko Cadell</title>
		<link>http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-29522</link>
		<dc:creator>Nicko Cadell</dc:creator>
		<pubDate>Thu, 03 Jan 2008 15:25:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/#comment-29522</guid>
		<description>Hi,

This sounds like a great enhancement, however I can&#039;t find the sources for the classes that you say are attachments to this blog.

Thanks,
Nicko</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>This sounds like a great enhancement, however I can&#8217;t find the sources for the classes that you say are attachments to this blog.</p>
<p>Thanks,<br />
Nicko</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.xebia.com/2007/10/05/mapping-multimaps-with-hibernate/feed/ ) in 0.44344 seconds, on Feb 9th, 2012 at 7:22 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 8:22 pm UTC -->
