<?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>simonpena.com &#187; errors</title>
	<atom:link href="http://simonpena.com/blog/tag/errors/feed/" rel="self" type="application/rss+xml" />
	<link>http://simonpena.com/blog</link>
	<description>Una mezcla heterogénea de tecnología y desvaríos</description>
	<lastBuildDate>Tue, 11 Oct 2011 19:14:43 +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>Hibernate common errors</title>
		<link>http://simonpena.com/blog/proyectos/pennybank/hibernate-common-errors/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hibernate-common-errors</link>
		<comments>http://simonpena.com/blog/proyectos/pennybank/hibernate-common-errors/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 22:43:26 +0000</pubDate>
		<dc:creator>Simón</dc:creator>
				<category><![CDATA[Pennybank]]></category>
		<category><![CDATA[deleted entity passed to persist]]></category>
		<category><![CDATA[detached entity passed to persist]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[id to load is required for loading]]></category>

		<guid isPermaLink="false">http://pennybank.wordpress.com/?p=43</guid>
		<description><![CDATA[A better explanation about some usual Hibernate-related errors: deleted entity passed to persist, detached entity passed to persist and id to load is required for loading<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/hibernate-common-errors/' addthis:title='Hibernate common errors '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p>Just two days after I <a title="Mind the Cascade" href="http://www.simonpena.com/blog/proyectos/pennybank/mind-the-cascade" target="_blank">blogged</a> <a title="Testing..." href="http://www.simonpena.com/blog/proyectos/pennybank/testing" target="_blank">about</a> the errors <strong>deleted entity passed to persist</strong>, <strong>detached entity passed to persist</strong> and <strong>id to load is required for loading</strong>, some people came here from web searches.</p>
<p>As I'm not sure if those explanations were clear enough, I'll try to synthesise here:</p>
<ul>
<li><strong>Deleted entity passed to persist</strong>. One entity, supposed to be deleted, is still referenced / accessed. In my case, I had a problem with "<em>cascading</em>". The behavior I expected was "<strong>on delete cascade</strong>" and "<strong>on update cascade</strong>". I have those constraints well in the database, but they weren't right in the Hibernate annotations. After I changed that, the error stopped. While I was searching why I was getting this error, I've seen people whose problem was different. They had, let's say, a list of entities. Those entities were related to others, and, when deleting, they had to take care of deleting both the link and the persisted entity. This was the most common scenario of this problem, and is better explained <a title="Ejb3 Tutorial 3 - Finish Conversion" href="http://schuchert.wikispaces.com/Ejb3+Tutorial+3+-+Finish+Conversion" target="_blank">here</a>, for example.</li>
<li><strong>Detached entity passed to persist</strong>. One entity, which is supposed to be up to date but is not, is passed to persist. In my case, I was trying to create an entity (an Operation), related to another (the Account where that Operation was taking place). The persist action was failing because my version of the Account was incorrect. The solution was just to update the entity.</li>
<li><strong>Id to load is required for loading</strong>. Trying to access an entity without giving an actual identifier. In my case this was the easiest problem: I was calling <em>find</em> passing a non initialized long. Passing the correct, initialized values fixed the problem.</li>
</ul>
<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/hibernate-common-errors/' addthis:title='Hibernate common errors '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonpena.com/blog/proyectos/pennybank/hibernate-common-errors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

