blob: 095bc5d84acc65c6d88e1e81b2bf9ca9c3beca19 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>5.&nbsp; Setting the Transaction Isolation</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_dbsetup.html" title="Chapter&nbsp;4.&nbsp; JDBC"><link rel="prev" href="ref_guide_dbsetup_dbsupport.html" title="4.&nbsp; Database Support"><link rel="next" href="ref_guide_dbsetup_sql92.html" title="6.&nbsp; Setting the SQL Join Syntax"></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">5.&nbsp;
Setting the Transaction Isolation
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_dbsetup_dbsupport.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;4.&nbsp;
JDBC
</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_dbsetup_sql92.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_dbsetup_isolation"></a>5.&nbsp;
Setting the Transaction Isolation
</h2></div></div></div><a class="indexterm" name="d0e20650"></a><a class="indexterm" name="d0e20655"></a><a class="indexterm" name="d0e20660"></a><p>
OpenJPA typically retains the default transaction isolation level of the JDBC
driver. However, you can specify a transaction isolation level to use through
the <a href="ref_guide_conf_jdbc.html#openjpa.jdbc.TransactionIsolation" title="6.18.&nbsp; openjpa.jdbc.TransactionIsolation"><code class="literal">
openjpa.jdbc.TransactionIsolation</code></a> configuration property. The
following is a list of standard isolation levels. Note that not all databases
support all isolation levels.
</p><div class="itemizedlist"><ul type="disc"><li><p>
<code class="literal">default</code>: Use the JDBC driver's default isolation level.
OpenJPA uses this option if you do not explicitly specify any other.
</p></li><li><p>
<code class="literal">none</code>: No transaction isolation.
</p></li><li><p>
<code class="literal">read-committed</code>: Dirty reads are prevented; non-repeatable
reads and phantom reads can occur.
</p></li><li><p>
<code class="literal">read-uncommitted</code>: Dirty reads, non-repeatable reads and
phantom reads can occur.
</p></li><li><p>
<code class="literal">repeatable-read</code>: Dirty reads and non-repeatable reads are
prevented; phantom reads can occur.
</p></li><li><p>
<code class="literal">serializable</code>: Dirty reads, non-repeatable reads, and phantom
reads are prevented.
</p></li></ul></div><div class="example"><a name="ref_guide_dbsetup_isoex"></a><p class="title"><b>Example&nbsp;4.7.&nbsp;
Specifying a Transaction Isolation
</b></p><div class="example-contents"><pre class="programlisting">
&lt;property name="openjpa.jdbc.TransactionIsolation" value="repeatable-read"/&gt;
</pre></div></div><br class="example-break"></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_dbsetup_dbsupport.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide_dbsetup.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_dbsetup_sql92.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">4.&nbsp;
Database Support
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;6.&nbsp;
Setting the SQL Join Syntax
</td></tr></table></div></body></html>