blob: 65cd227ba2aa0da531b1f52b3a9b8611838d5eb4 [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><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="manual.html" title="Apache OpenJPA 3.0 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" id="ref_guide_dbsetup_isolation"><div class="titlepage"><div><div><h2 class="title" style="clear: both">5.&nbsp;
Setting the Transaction Isolation
</h2></div></div></div>
<a class="indexterm" name="d5e11509"></a>
<a class="indexterm" name="d5e11512"></a>
<a class="indexterm" name="d5e11515"></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 class="link" 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 class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<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 class="listitem">
<p>
<code class="literal">none</code>: No transaction isolation.
</p>
</li><li class="listitem">
<p>
<code class="literal">read-committed</code>: Dirty reads are prevented; non-repeatable
reads and phantom reads can occur.
</p>
</li><li class="listitem">
<p>
<code class="literal">read-uncommitted</code>: Dirty reads, non-repeatable reads and
phantom reads can occur.
</p>
</li><li class="listitem">
<p>
<code class="literal">repeatable-read</code>: Dirty reads and non-repeatable reads are
prevented; phantom reads can occur.
</p>
</li><li class="listitem">
<p>
<code class="literal">serializable</code>: Dirty reads, non-repeatable reads, and phantom
reads are prevented.
</p>
</li></ul></div>
<div class="example" id="ref_guide_dbsetup_isoex"><p class="title"><b>Example&nbsp;4.8.&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>