<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=sbrannen" rel="nofollow">Sam Brannen</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-7161?redirect=false" rel="nofollow">SPR-7161</a></strong> and commented</p>
<p dir="auto">The reference manual should updated regarding PetClinic's new location (i.e., available in a separate subversion repository), etc.</p>
<p dir="auto">See comments in the forums.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0.2</p>
<p dir="auto"><strong>Reference URL:</strong> <a href="http://forum.springsource.org/showthread.php?t=73291&amp;page=2" rel="nofollow">http://forum.springsource.org/showthread.php?t=73291&amp;page=2</a></p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398104950" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/11822" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/11822/hovercard" href="https://github.com/spring-projects/spring-framework/issues/11822">#11822</a> Link to location of Spring samples in reference documentation (<em><strong>"is duplicated by"</strong></em>)</li>
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398098286" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10890" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10890/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10890">#10890</a> Update PetClinic tutorial, readme files, and DB scripts for Spring 3.0</li>
</ul>
<p dir="auto"><strong>Referenced from:</strong> commits <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/spring-projects/spring-framework/commit/42cdfbcd89c3116622fee5d1c57435ae70fcc344/hovercard" href="https://github.com/spring-projects/spring-framework/commit/42cdfbcd89c3116622fee5d1c57435ae70fcc344"><tt>42cdfbc</tt></a></p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=bbrady" rel="nofollow">Bob Brady</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-3616?redirect=false" rel="nofollow">SPR-3616</a></strong> and commented</p>
<p dir="auto">I am using HibernateTemplate to load all persisted objects of a class that has a collection of enums.  The problem is that for each enum in the collection, I get a copy of the parent object when calling HibernateTemplate's loadAll.</p>
<p dir="auto">Say ExampleDomain is the parent class and it has a collection of Units like so:</p>
<p dir="auto">[CODE]<br>
<code class="notranslate">@CollectionOfElements</code>(fetch=FetchType.EAGER)<br>
<code class="notranslate">@JoinTable</code>(joinColumns = <code class="notranslate">@JoinColumn</code>(name="MY_EXAMPLE_ID"))<br>
<code class="notranslate">@Column</code>(nullable=true)<br>
<code class="notranslate">@Enumerated</code>(value=EnumType.STRING)<br>
public Set&lt;Units&gt; getChosenUnits()<br>
{<br>
return this.chosenUnits;<br>
}<br>
[/CODE]</p>
<p dir="auto">Then If I add three Units to the an instance of ExampleDomain and persist it, HibernateTemplate will return three identical copies of the persisted object!  Here's a snippet:</p>
<p dir="auto">[CODE]<br>
ExampleDomain ed = new ExampleDomain();<br>
...<br>
// Add 3 Units to collection<br>
Set&lt;Units&gt; allUnits = new HashSet&lt;Units&gt;();<br>
allUnits.add(units1);<br>
allUnits.add(units2);<br>
allUnits.add(units3);<br>
ed.setChosenUnits(allUnits);<br>
// We're, clean: this returns an empty list<br>
List&lt;ExampleDomain&gt; domains = this.getHibernateTemplate().loadAll(ExampleDomain.class);<br>
// Persist the newly created ExampleDomain object<br>
this.getHibernateTemplate().saveOrUpdatel(ed);<br>
// Now we get back three duplicate objects!<br>
domains = this.getHibernateTemplate().loadAll(ExampleDomain.class);<br>
[/CODE]</p>
<p dir="auto">Myself and a co-worker have duplicated this behavior with different classes, but the same collection of enum elements format.  Also, others have reported a similar issue in the Spring forums (Re: <a href="http://forum.springframework.org/showthread.php?p=128103&amp;posted=1#post128103" rel="nofollow">http://forum.springframework.org/showthread.php?p=128103&amp;posted=1#post128103</a> ).</p>
<p dir="auto">Our workaround is simple to use HQL instead of loadAll:</p>
<p dir="auto">[CODE]<br>
this.getHibernateTemplate().find("from ExampleDomain");<br>
[/CODE]</p>
<p dir="auto">Thank you,<br>
Bob</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.6</p>