<?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: EJB 3.0 Java Persistence API &#8211; &quot;Refresh After Insert&quot;: Using EntityListeners to absorb the effects from Database Triggers</title>
	<atom:link href="http://technology.amis.nl/2006/10/17/ejb-30-java-persistence-api-refresh-after-insert-using-entitylisteners-to-absorb-the-effects-from-database-triggers/feed/" rel="self" type="application/rss+xml" />
	<link>http://technology.amis.nl/2006/10/17/ejb-30-java-persistence-api-refresh-after-insert-using-entitylisteners-to-absorb-the-effects-from-database-triggers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ejb-30-java-persistence-api-refresh-after-insert-using-entitylisteners-to-absorb-the-effects-from-database-triggers</link>
	<description></description>
	<lastBuildDate>Fri, 12 Apr 2013 10:04:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Jay</title>
		<link>http://technology.amis.nl/2006/10/17/ejb-30-java-persistence-api-refresh-after-insert-using-entitylisteners-to-absorb-the-effects-from-database-triggers/#comment-3912</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Mon, 04 Dec 2006 20:54:23 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1363#comment-3912</guid>
		<description><![CDATA[Section 3.4 of the spec states:

The following rules apply to callbacks:

...

Callbacks can invoke JNDI, JDBC, JMS, and enterprise beans, but NOT the EntityManager. (emphasis mine)


You stated, &quot;The EntityRefresher gets injected the EntityManager from somewhere at some point in time prior to the actual insert taking place.&quot;  via the setEm method? Can you be more specific as to the &quot;from somewhere&quot; and &quot;at some point in time prior to&quot; ?

The idea is exactly what I need; I guess I need to play around with a little more to get it working.]]></description>
		<content:encoded><![CDATA[<p>Section 3.4 of the spec states:</p>
<p>The following rules apply to callbacks:</p>
<p>&#8230;</p>
<p>Callbacks can invoke JNDI, JDBC, JMS, and enterprise beans, but NOT the EntityManager. (emphasis mine)</p>
<p>You stated, &#8220;The EntityRefresher gets injected the EntityManager from somewhere at some point in time prior to the actual insert taking place.&#8221;  via the setEm method? Can you be more specific as to the &#8220;from somewhere&#8221; and &#8220;at some point in time prior to&#8221; ?</p>
<p>The idea is exactly what I need; I guess I need to play around with a little more to get it working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vatel</title>
		<link>http://technology.amis.nl/2006/10/17/ejb-30-java-persistence-api-refresh-after-insert-using-entitylisteners-to-absorb-the-effects-from-database-triggers/#comment-3911</link>
		<dc:creator>vatel</dc:creator>
		<pubDate>Sun, 22 Oct 2006 23:54:13 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1363#comment-3911</guid>
		<description><![CDATA[I&#039;ve just re-read the &quot;EJB 3.0 - Persistence&quot; specification,
in &quot;3.5 Entity Listeners and Callback Methods&quot; it say:

&quot;In general, portable applications should not invoke EntityManager or Query operations,
access other entity instances, or modify relationships in a lifecycle callback method.&quot;
(page 58)

This means that it is not portable to use em.refresh(), em.find(), em.createQuery(), etc. operations in @PostPersist handler.

So, the example above works well in this concrete implementation, but it is not guaranteed to work everywhere... So, a better way would be to use @PrePersist and set entity fields there instead of trigger.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve just re-read the &#8220;EJB 3.0 &#8211; Persistence&#8221; specification,<br />
in &#8220;3.5 Entity Listeners and Callback Methods&#8221; it say:</p>
<p>&#8220;In general, portable applications should not invoke EntityManager or Query operations,<br />
access other entity instances, or modify relationships in a lifecycle callback method.&#8221;<br />
(page 58)</p>
<p>This means that it is not portable to use em.refresh(), em.find(), em.createQuery(), etc. operations in @PostPersist handler.</p>
<p>So, the example above works well in this concrete implementation, but it is not guaranteed to work everywhere&#8230; So, a better way would be to use @PrePersist and set entity fields there instead of trigger.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: site admin</title>
		<link>http://technology.amis.nl/2006/10/17/ejb-30-java-persistence-api-refresh-after-insert-using-entitylisteners-to-absorb-the-effects-from-database-triggers/#comment-3910</link>
		<dc:creator>site admin</dc:creator>
		<pubDate>Sat, 21 Oct 2006 07:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1363#comment-3910</guid>
		<description><![CDATA[Hi Duke,

The JPA will not get back control before the database has completed the set of statements that were flushed or the transaction has been executed. In an Oracle database at least, row-level triggers (as well as statement level trigers by the way) will complete before the JPA regains control. That means that when the EntityListener is called (back), the full trigger effect will be there.

regards

Lucas]]></description>
		<content:encoded><![CDATA[<p>Hi Duke,</p>
<p>The JPA will not get back control before the database has completed the set of statements that were flushed or the transaction has been executed. In an Oracle database at least, row-level triggers (as well as statement level trigers by the way) will complete before the JPA regains control. That means that when the EntityListener is called (back), the full trigger effect will be there.</p>
<p>regards</p>
<p>Lucas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Duke Javastein</title>
		<link>http://technology.amis.nl/2006/10/17/ejb-30-java-persistence-api-refresh-after-insert-using-entitylisteners-to-absorb-the-effects-from-database-triggers/#comment-3909</link>
		<dc:creator>Duke Javastein</dc:creator>
		<pubDate>Sat, 21 Oct 2006 00:04:56 +0000</pubDate>
		<guid isPermaLink="false">http://technology.amis.nl/blog/?p=1363#comment-3909</guid>
		<description><![CDATA[Hi,

What if when the JPA engine called the insertEntity method the trigger was not completed? Is it guaranteed that the trigger completes in the same transaction that the insert is performed?

- Duke]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>What if when the JPA engine called the insertEntity method the trigger was not completed? Is it guaranteed that the trigger completes in the same transaction that the insert is performed?</p>
<p>- Duke</p>
]]></content:encoded>
	</item>
</channel>
</rss>
