blob: 3c0513b48ad39bbb0f1c2631dbd4c0af040f5282 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>7.&nbsp; Transaction Events</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA User's Guide"><link rel="up" href="ref_guide_runtime.html" title="Chapter&nbsp;9.&nbsp; Runtime Extensions"><link rel="prev" href="ref_guide_sequence.html" title="6.&nbsp; Generators"><link rel="next" href="ref_guide_enterprise_abstractstore.html" title="8.&nbsp; Non-Relational Stores"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">7.&nbsp;
Transaction Events
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_sequence.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;9.&nbsp;
Runtime Extensions
</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_enterprise_abstractstore.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_runtime_pm_event"></a>7.&nbsp;
Transaction Events
</h2></div></div></div><a class="indexterm" name="d0e28467"></a><p>
The OpenJPA runtime supports broadcasting transaction-related events. By
registering one or more
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/event/TransactionListener.html" target="_top">
<code class="classname">org.apache.openjpa.event.TransactionListener</code></a> s,
you can receive notifications when transactions begin, flush, rollback, commit,
and more. Where appropriate, event notifications include the set of
persistence-capable objects participating in the transaction.
</p><pre class="programlisting">
public void addTransactionListener(Object listener);
public void removeTransactionListener(Object listener);
</pre><p>
These <code class="classname">OpenJPAEntityManager</code> methods allow you to add and
remove listeners.
</p><p>
For details on the transaction framework, see the <code class="literal">
org.apache.openjpa.event</code> package
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/event/package.html" target="_top">Javadoc</a>.
Also see <a href="ref_guide_event.html" title="2.&nbsp; Remote Event Notification Framework">Section&nbsp;2, &#8220;
Remote Event Notification Framework
&#8221;</a> for a description of OpenJPA's
remote event support.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_sequence.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide_runtime.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_enterprise_abstractstore.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6.&nbsp;
Generators
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;8.&nbsp;
Non-Relational Stores
</td></tr></table></div></body></html>