| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_252) on Fri Jul 16 09:38:49 UTC 2021 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>ExclusiveConnectionMode (EclipseLink 3.0.2, API Reference)</title> |
| <meta name="date" content="2021-07-16"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="ExclusiveConnectionMode (EclipseLink 3.0.2, API Reference)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage">EclipseLink 3.0.2, API Reference</div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/eclipse/persistence/config/EntityManagerProperties.html" title="class in org.eclipse.persistence.config"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/eclipse/persistence/config/FlushClearCache.html" title="class in org.eclipse.persistence.config"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/eclipse/persistence/config/ExclusiveConnectionMode.html" target="_top">Frames</a></li> |
| <li><a href="ExclusiveConnectionMode.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li>Method</li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.eclipse.persistence.config</div> |
| <h2 title="Class ExclusiveConnectionMode" class="title">Class ExclusiveConnectionMode</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.eclipse.persistence.config.ExclusiveConnectionMode</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">ExclusiveConnectionMode</span> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> |
| <div class="block">This property could be specified while creating either EntityManagerFactory |
| (createEntityManagerFactory or persistence.xml) |
| or EntityManager (createEntityManager); the latter overrides the former. |
| |
| The "isolated case" mentioned below is the case of some (or all) entities requiring isolated cache. |
| That could be achieved either by specifying the property for one or more entities: |
| eclipselink.cache.shared.Employee -> "false" |
| or for all entities: |
| eclipselink.cache.shared.default -> "false" |
| Note that this property(es) could be specified only on persistence unit level (cannot be passed to createEntityManager method). |
| |
| <p>JPA persistence property Usage: |
| |
| <p><code>properties.add(PersistenceUnitProperties.EXCLUSIVE_CONNECTION_MODE, ExclusiveConnectionMode.Isolated);</code> |
| |
| <p>Values are case-insensitive. |
| "" could be used instead of default value ExclusiveConnectionMode.DEFAULT.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../org/eclipse/persistence/config/PersistenceUnitProperties.html" title="class in org.eclipse.persistence.config"><code>PersistenceUnitProperties</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/config/ExclusiveConnectionMode.html#Always">Always</a></span></code> |
| <div class="block">The value causes creation of ExclusiveIsolatedClientSession |
| in both isolated and non-isolated cases.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/config/ExclusiveConnectionMode.html#DEFAULT">DEFAULT</a></span></code> </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/config/ExclusiveConnectionMode.html#Isolated">Isolated</a></span></code> |
| <div class="block">The value causes creation of |
| ExclusiveIsolatedClientSession in isolated case |
| and throws exception otherwise.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/config/ExclusiveConnectionMode.html#Transactional">Transactional</a></span></code> |
| <div class="block">The value causes creation of |
| IsolatedClientSession in isolated case |
| and ClientSession otherwise.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/eclipse/persistence/config/ExclusiveConnectionMode.html#ExclusiveConnectionMode--">ExclusiveConnectionMode</a></span>()</code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="Transactional"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>Transactional</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> Transactional</pre> |
| <div class="block">The value causes creation of |
| IsolatedClientSession in isolated case |
| and ClientSession otherwise. |
| Connection is kept exclusive for the duration of Eclipselink transaction. |
| Inside Eclipselink transaction all writes and reads performed through the exclusive connection. |
| Outside Eclipselink transaction a new connection is acquired from connection pool |
| for each read and released back immediately after the query is executed. |
| |
| Note that Eclipselink transaction usually starts later then JTA transaction does, |
| or entityManager.beginTransaction method is called: Eclipselink usually waits until |
| it's about to perform a query that potentially alters data base's state to start |
| Exclipselink transaction. That reflects in connection usage in Transactional mode. |
| Example: |
| // Eclipselink transaction is not started yet - readQuery1 acquires and immediately releases connection. |
| readQuery1.getResultList(); |
| entityManager.getTransaction().begin(); |
| // Eclipselink transaction still not started yet - readQuery2 acquires and immediately releases connection. |
| readQuery2.getResultList(); |
| entityManager.persist(new Employee()); |
| // Eclipselink transaction is not started yet - readQuery3 acquires and immediately releases connection. |
| readQuery3.getResultList(); |
| entityManager.flush(); |
| // Before the flushing is performed Exclipselink transaction is started: |
| // connection is acquired that will be kept until the end of transaction and used for all reads and writes. |
| readQuery4.getResultList(); |
| entityManager.commit(); |
| // Eclipselink transaction is completed, the connection used by Eclipselink transaction is released; |
| // readQuery5 acquires and immediately releases connection. |
| readQuery5.getResultList(); |
| |
| There's a way to force beginning of Eclipselink transaction right before executing the first query after em.getTransaction().begin(): |
| "eclipselink.transaction.join-existing" -> true. |
| In the example that setting would force Exclipselink transaction top begin right before readQuery2 is executed |
| and therefore cause execution of readQuery2 and readQuery3 through the exclusive connection |
| (of course the same connection would be used by readQuery4 and flush, too). |
| However this approach could hardly be recommended: |
| none of the objects read after Eclipselink transaction begins |
| get into the shared cache unless altered therefore seriously reducing benefits of Eclipselink shared cache.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../constant-values.html#org.eclipse.persistence.config.ExclusiveConnectionMode.Transactional">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="Isolated"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>Isolated</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> Isolated</pre> |
| <div class="block">The value causes creation of |
| ExclusiveIsolatedClientSession in isolated case |
| and throws exception otherwise. |
| Connection is kept exclusive for the whole lifetime of the owning EntityManager. |
| Inside Eclipselink transaction all writes and reads performed through the exclusive connection. |
| Outside Eclipelink transaction only isolated entities are read through the exclusive connection; |
| for non isolated entities a new connection is acquired from connection pool |
| for each read and released back immediately after the query is executed. |
| |
| In the example presented above all five readQueries |
| would read isolated entity through the exclusive connection, |
| however non-isolated entity would be read the same as in Transactional mode.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../constant-values.html#org.eclipse.persistence.config.ExclusiveConnectionMode.Isolated">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="Always"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>Always</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> Always</pre> |
| <div class="block">The value causes creation of ExclusiveIsolatedClientSession |
| in both isolated and non-isolated cases. |
| Connection is kept exclusive for the whole lifetime of the owning EntityManager. |
| All writes and reads performed through the exclusive connection. |
| |
| In the example presented above all five readQueries |
| would read all entity through the exclusive connection. |
| |
| Note that though all entities use the exclusive connection |
| only isolated entities use isolated cache; non-isolated entities use shared cache.</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../constant-values.html#org.eclipse.persistence.config.ExclusiveConnectionMode.Always">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="DEFAULT"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>DEFAULT</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> DEFAULT</pre> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../constant-values.html#org.eclipse.persistence.config.ExclusiveConnectionMode.DEFAULT">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="ExclusiveConnectionMode--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>ExclusiveConnectionMode</h4> |
| <pre>public ExclusiveConnectionMode()</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage">EclipseLink 3.0.2, API Reference</div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/eclipse/persistence/config/EntityManagerProperties.html" title="class in org.eclipse.persistence.config"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/eclipse/persistence/config/FlushClearCache.html" title="class in org.eclipse.persistence.config"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/eclipse/persistence/config/ExclusiveConnectionMode.html" target="_top">Frames</a></li> |
| <li><a href="ExclusiveConnectionMode.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#methods.inherited.from.class.java.lang.Object">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li>Method</li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2007–2021 <a href="http://www.eclipse.org/eclipselink">Eclipse.org - EclipseLink Project</a>. All rights reserved.</small></p> |
| </body> |
| </html> |