blob: 4fd696c368db49e1581ac1b35acf4057098fdb93 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>EntityManager</title>
<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="EntityManager";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6,"i22":6,"i23":6,"i24":6,"i25":6,"i26":6,"i27":6,"i28":6,"i29":6,"i30":6,"i31":6,"i32":6,"i33":6,"i34":6,"i35":6,"i36":6,"i37":6,"i38":6,"i39":6,"i40":6,"i41":6,"i42":6,"i43":6,"i44":6,"i45":6,"i46":6,"i47":6,"i48":6,"i49":6,"i50":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</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>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/persistence/EntityListeners.html" title="annotation in javax.persistence"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/persistence/EntityManagerFactory.html" title="interface in javax.persistence"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/persistence/EntityManager.html" target="_top">Frames</a></li>
<li><a href="EntityManager.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">javax.persistence</div>
<h2 title="Interface EntityManager" class="title">Interface EntityManager</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../org/apache/openejb/persistence/JtaEntityManager.html" title="class in org.apache.openejb.persistence">JtaEntityManager</a>, <a href="../../org/apache/openejb/persistence/QueryLogEntityManager.html" title="class in org.apache.openejb.persistence">QueryLogEntityManager</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">EntityManager</span></pre>
<div class="block">Interface used to interact with the persistence context.
<p> An <code>EntityManager</code> instance is associated with
a persistence context. A persistence context is a set of entity
instances in which for any persistent entity identity there is
a unique entity instance. Within the persistence context, the
entity instances and their lifecycle are managed.
The <code>EntityManager</code> API is used
to create and remove persistent entity instances, to find entities
by their primary key, and to query over entities.
<p> The set of entities that can be managed by a given
<code>EntityManager</code> instance is defined by a persistence
unit. A persistence unit defines the set of all classes that are
related or grouped by the application, and which must be
colocated in their mapping to a single database.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../javax/persistence/Query.html" title="interface in javax.persistence"><code>Query</code></a>,
<a href="../../javax/persistence/TypedQuery.html" title="interface in javax.persistence"><code>TypedQuery</code></a>,
<a href="../../javax/persistence/criteria/CriteriaQuery.html" title="interface in javax.persistence.criteria"><code>CriteriaQuery</code></a>,
<a href="../../javax/persistence/PersistenceContext.html" title="annotation in javax.persistence"><code>PersistenceContext</code></a>,
<a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence"><code>StoredProcedureQuery</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#clear--">clear</a></span>()</code>
<div class="block">Clear the persistence context, causing all managed
entities to become detached.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#close--">close</a></span>()</code>
<div class="block">Close an application-managed entity manager.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#contains-java.lang.Object-">contains</a></span>(java.lang.Object&nbsp;entity)</code>
<div class="block">Check if the instance is a managed entity instance belonging
to the current persistence context.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createEntityGraph-java.lang.Class-">createEntityGraph</a></span>(java.lang.Class&lt;T&gt;&nbsp;rootType)</code>
<div class="block">Return a mutable EntityGraph that can be used to dynamically create an
EntityGraph.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;?&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createEntityGraph-java.lang.String-">createEntityGraph</a></span>(java.lang.String&nbsp;graphName)</code>
<div class="block">Return a mutable copy of the named EntityGraph.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createNamedQuery-java.lang.String-">createNamedQuery</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Create an instance of <code>Query</code> for executing a named query
(in the Java Persistence query language or in native SQL).</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../javax/persistence/TypedQuery.html" title="interface in javax.persistence">TypedQuery</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createNamedQuery-java.lang.String-java.lang.Class-">createNamedQuery</a></span>(java.lang.String&nbsp;name,
java.lang.Class&lt;T&gt;&nbsp;resultClass)</code>
<div class="block">Create an instance of <code>TypedQuery</code> for executing a
Java Persistence query language named query.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createNamedStoredProcedureQuery-java.lang.String-">createNamedStoredProcedureQuery</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createNativeQuery-java.lang.String-">createNativeQuery</a></span>(java.lang.String&nbsp;sqlString)</code>
<div class="block">Create an instance of <code>Query</code> for executing
a native SQL statement, e.g., for update or delete.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createNativeQuery-java.lang.String-java.lang.Class-">createNativeQuery</a></span>(java.lang.String&nbsp;sqlString,
java.lang.Class&nbsp;resultClass)</code>
<div class="block">Create an instance of <code>Query</code> for executing
a native SQL query.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createNativeQuery-java.lang.String-java.lang.String-">createNativeQuery</a></span>(java.lang.String&nbsp;sqlString,
java.lang.String&nbsp;resultSetMapping)</code>
<div class="block">Create an instance of <code>Query</code> for executing
a native SQL query.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createQuery-javax.persistence.criteria.CriteriaDelete-">createQuery</a></span>(<a href="../../javax/persistence/criteria/CriteriaDelete.html" title="interface in javax.persistence.criteria">CriteriaDelete</a>&nbsp;deleteQuery)</code>
<div class="block">Create an instance of <code>Query</code> for executing a criteria
delete query.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../javax/persistence/TypedQuery.html" title="interface in javax.persistence">TypedQuery</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createQuery-javax.persistence.criteria.CriteriaQuery-">createQuery</a></span>(<a href="../../javax/persistence/criteria/CriteriaQuery.html" title="interface in javax.persistence.criteria">CriteriaQuery</a>&lt;T&gt;&nbsp;criteriaQuery)</code>
<div class="block">Create an instance of <code>TypedQuery</code> for executing a
criteria query.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createQuery-javax.persistence.criteria.CriteriaUpdate-">createQuery</a></span>(<a href="../../javax/persistence/criteria/CriteriaUpdate.html" title="interface in javax.persistence.criteria">CriteriaUpdate</a>&nbsp;updateQuery)</code>
<div class="block">Create an instance of <code>Query</code> for executing a criteria
update query.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createQuery-java.lang.String-">createQuery</a></span>(java.lang.String&nbsp;qlString)</code>
<div class="block">Create an instance of <code>Query</code> for executing a
Java Persistence query language statement.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;<a href="../../javax/persistence/TypedQuery.html" title="interface in javax.persistence">TypedQuery</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createQuery-java.lang.String-java.lang.Class-">createQuery</a></span>(java.lang.String&nbsp;qlString,
java.lang.Class&lt;T&gt;&nbsp;resultClass)</code>
<div class="block">Create an instance of <code>TypedQuery</code> for executing a
Java Persistence query language statement.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createStoredProcedureQuery-java.lang.String-">createStoredProcedureQuery</a></span>(java.lang.String&nbsp;procedureName)</code>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createStoredProcedureQuery-java.lang.String-java.lang.Class...-">createStoredProcedureQuery</a></span>(java.lang.String&nbsp;procedureName,
java.lang.Class...&nbsp;resultClasses)</code>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#createStoredProcedureQuery-java.lang.String-java.lang.String...-">createStoredProcedureQuery</a></span>(java.lang.String&nbsp;procedureName,
java.lang.String...&nbsp;resultSetMappings)</code>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#detach-java.lang.Object-">detach</a></span>(java.lang.Object&nbsp;entity)</code>
<div class="block">Remove the given entity from the persistence context, causing
a managed entity to become detached.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#find-java.lang.Class-java.lang.Object-">find</a></span>(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey)</code>
<div class="block">Find by primary key.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#find-java.lang.Class-java.lang.Object-javax.persistence.LockModeType-">find</a></span>(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode)</code>
<div class="block">Find by primary key and lock.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#find-java.lang.Class-java.lang.Object-javax.persistence.LockModeType-java.util.Map-">find</a></span>(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</code>
<div class="block">Find by primary key and lock, using the specified properties.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#find-java.lang.Class-java.lang.Object-java.util.Map-">find</a></span>(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</code>
<div class="block">Find by primary key, using the specified properties.</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#flush--">flush</a></span>()</code>
<div class="block">Synchronize the persistence context to the
underlying database.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/criteria/CriteriaBuilder.html" title="interface in javax.persistence.criteria">CriteriaBuilder</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getCriteriaBuilder--">getCriteriaBuilder</a></span>()</code>
<div class="block">Return an instance of <code>CriteriaBuilder</code> for the creation of
<code>CriteriaQuery</code> objects.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getDelegate--">getDelegate</a></span>()</code>
<div class="block">Return the underlying provider object for the <code>EntityManager</code>,
if available.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;?&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getEntityGraph-java.lang.String-">getEntityGraph</a></span>(java.lang.String&nbsp;graphName)</code>
<div class="block">Return a named EntityGraph.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;java.util.List&lt;<a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;? super T&gt;&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getEntityGraphs-java.lang.Class-">getEntityGraphs</a></span>(java.lang.Class&lt;T&gt;&nbsp;entityClass)</code>
<div class="block">Return all named EntityGraphs that have been defined for the provided
class type.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/EntityManagerFactory.html" title="interface in javax.persistence">EntityManagerFactory</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getEntityManagerFactory--">getEntityManagerFactory</a></span>()</code>
<div class="block">Return the entity manager factory for the entity manager.</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getFlushMode--">getFlushMode</a></span>()</code>
<div class="block">Get the flush mode that applies to all objects contained
in the persistence context.</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getLockMode-java.lang.Object-">getLockMode</a></span>(java.lang.Object&nbsp;entity)</code>
<div class="block">Get the current lock mode for the entity instance.</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code><a href="../../javax/persistence/metamodel/Metamodel.html" title="interface in javax.persistence.metamodel">Metamodel</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getMetamodel--">getMetamodel</a></span>()</code>
<div class="block">Return an instance of <code>Metamodel</code> interface for access to the
metamodel of the persistence unit.</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>java.util.Map&lt;java.lang.String,java.lang.Object&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getProperties--">getProperties</a></span>()</code>
<div class="block">Get the properties and hints and associated values that are in effect
for the entity manager.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getReference-java.lang.Class-java.lang.Object-">getReference</a></span>(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey)</code>
<div class="block">Get an instance, whose state may be lazily fetched.</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code><a href="../../javax/persistence/EntityTransaction.html" title="interface in javax.persistence">EntityTransaction</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#getTransaction--">getTransaction</a></span>()</code>
<div class="block">Return the resource-level <code>EntityTransaction</code> object.</div>
</td>
</tr>
<tr id="i36" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#isJoinedToTransaction--">isJoinedToTransaction</a></span>()</code>
<div class="block">Determine whether the entity manager is joined to the
current transaction.</div>
</td>
</tr>
<tr id="i37" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#isOpen--">isOpen</a></span>()</code>
<div class="block">Determine whether the entity manager is open.</div>
</td>
</tr>
<tr id="i38" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#joinTransaction--">joinTransaction</a></span>()</code>
<div class="block">Indicate to the entity manager that a JTA transaction is
active and join the persistence context to it.</div>
</td>
</tr>
<tr id="i39" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#lock-java.lang.Object-javax.persistence.LockModeType-">lock</a></span>(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode)</code>
<div class="block">Lock an entity instance that is contained in the persistence
context with the specified lock mode type.</div>
</td>
</tr>
<tr id="i40" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#lock-java.lang.Object-javax.persistence.LockModeType-java.util.Map-">lock</a></span>(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</code>
<div class="block">Lock an entity instance that is contained in the persistence
context with the specified lock mode type and with specified
properties.</div>
</td>
</tr>
<tr id="i41" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#merge-T-">merge</a></span>(T&nbsp;entity)</code>
<div class="block">Merge the state of the given entity into the
current persistence context.</div>
</td>
</tr>
<tr id="i42" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#persist-java.lang.Object-">persist</a></span>(java.lang.Object&nbsp;entity)</code>
<div class="block">Make an instance managed and persistent.</div>
</td>
</tr>
<tr id="i43" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#refresh-java.lang.Object-">refresh</a></span>(java.lang.Object&nbsp;entity)</code>
<div class="block">Refresh the state of the instance from the database,
overwriting changes made to the entity, if any.</div>
</td>
</tr>
<tr id="i44" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#refresh-java.lang.Object-javax.persistence.LockModeType-">refresh</a></span>(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode)</code>
<div class="block">Refresh the state of the instance from the database,
overwriting changes made to the entity, if any, and
lock it with respect to given lock mode type.</div>
</td>
</tr>
<tr id="i45" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#refresh-java.lang.Object-javax.persistence.LockModeType-java.util.Map-">refresh</a></span>(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</code>
<div class="block">Refresh the state of the instance from the database,
overwriting changes made to the entity, if any, and
lock it with respect to given lock mode type and with
specified properties.</div>
</td>
</tr>
<tr id="i46" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#refresh-java.lang.Object-java.util.Map-">refresh</a></span>(java.lang.Object&nbsp;entity,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</code>
<div class="block">Refresh the state of the instance from the database, using
the specified properties, and overwriting changes made to
the entity, if any.</div>
</td>
</tr>
<tr id="i47" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#remove-java.lang.Object-">remove</a></span>(java.lang.Object&nbsp;entity)</code>
<div class="block">Remove the entity instance.</div>
</td>
</tr>
<tr id="i48" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#setFlushMode-javax.persistence.FlushModeType-">setFlushMode</a></span>(<a href="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</a>&nbsp;flushMode)</code>
<div class="block">Set the flush mode that applies to all objects contained
in the persistence context.</div>
</td>
</tr>
<tr id="i49" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#setProperty-java.lang.String-java.lang.Object-">setProperty</a></span>(java.lang.String&nbsp;propertyName,
java.lang.Object&nbsp;value)</code>
<div class="block">Set an entity manager property or hint.</div>
</td>
</tr>
<tr id="i50" class="altColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/EntityManager.html#unwrap-java.lang.Class-">unwrap</a></span>(java.lang.Class&lt;T&gt;&nbsp;cls)</code>
<div class="block">Return an object of the specified type to allow access to the
provider-specific API.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="persist-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>persist</h4>
<pre>void&nbsp;persist(java.lang.Object&nbsp;entity)</pre>
<div class="block">Make an instance managed and persistent.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/persistence/EntityExistsException.html" title="class in javax.persistence">EntityExistsException</a></code> - if the entity already exists.
(If the entity already exists, the <code>EntityExistsException</code> may
be thrown when the persist operation is invoked, or the
<code>EntityExistsException</code> or another <code>PersistenceException</code> may be
thrown at flush or commit time.)</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not an
entity</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no transaction when
invoked on a container-managed entity manager of that is of type
<code>PersistenceContextType.TRANSACTION</code></dd>
</dl>
</li>
</ul>
<a name="merge-java.lang.Object-">
<!-- -->
</a><a name="merge-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>merge</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;merge(T&nbsp;entity)</pre>
<div class="block">Merge the state of the given entity into the
current persistence context.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the managed instance that the state was merged to</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if instance is not an
entity or is a removed entity</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no transaction when
invoked on a container-managed entity manager of that is of type
<code>PersistenceContextType.TRANSACTION</code></dd>
</dl>
</li>
</ul>
<a name="remove-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>void&nbsp;remove(java.lang.Object&nbsp;entity)</pre>
<div class="block">Remove the entity instance.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not an
entity or is a detached entity</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if invoked on a
container-managed entity manager of type
<code>PersistenceContextType.TRANSACTION</code> and there is
no transaction</dd>
</dl>
</li>
</ul>
<a name="find-java.lang.Class-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>find</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;find(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey)</pre>
<div class="block">Find by primary key.
Search for an entity of the specified class and primary key.
If the entity instance is contained in the persistence context,
it is returned from there.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entityClass</code> - entity class</dd>
<dd><code>primaryKey</code> - primary key</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the found entity instance or null if the entity does
not exist</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the first argument does
not denote an entity type or the second argument is
is not a valid type for that entity's primary key or
is null</dd>
</dl>
</li>
</ul>
<a name="find-java.lang.Class-java.lang.Object-java.util.Map-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>find</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;find(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</pre>
<div class="block">Find by primary key, using the specified properties.
Search for an entity of the specified class and primary key.
If the entity instance is contained in the persistence
context, it is returned from there.
If a vendor-specific property or hint is not recognized,
it is silently ignored.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entityClass</code> - entity class</dd>
<dd><code>primaryKey</code> - primary key</dd>
<dd><code>properties</code> - standard and vendor-specific properties
and hints</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the found entity instance or null if the entity does
not exist</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the first argument does
not denote an entity type or the second argument is
is not a valid type for that entity's primary key or
is null</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="find-java.lang.Class-java.lang.Object-javax.persistence.LockModeType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>find</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;find(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode)</pre>
<div class="block">Find by primary key and lock.
Search for an entity of the specified class and primary key
and lock it with respect to the specified lock type.
If the entity instance is contained in the persistence context,
it is returned from there, and the effect of this method is
the same as if the lock method had been called on the entity.
<p> If the entity is found within the persistence context and the
lock mode type is pessimistic and the entity has a version
attribute, the persistence provider must perform optimistic
version checks when obtaining the database lock. If these
checks fail, the <code>OptimisticLockException</code> will be thrown.
<p>If the lock mode type is pessimistic and the entity instance
is found but cannot be locked:
<ul>
<li> the <code>PessimisticLockException</code> will be thrown if the database
locking failure causes transaction-level rollback
<li> the <code>LockTimeoutException</code> will be thrown if the database
locking failure causes only statement-level rollback
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entityClass</code> - entity class</dd>
<dd><code>primaryKey</code> - primary key</dd>
<dd><code>lockMode</code> - lock mode</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the found entity instance or null if the entity does
not exist</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the first argument does
not denote an entity type or the second argument is
not a valid type for that entity's primary key or
is null</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no
transaction and a lock mode other than <code>NONE</code> is
specified or if invoked on an entity manager which has
not been joined to the current transaction and a lock
mode other than <code>NONE</code> is specified</dd>
<dd><code><a href="../../javax/persistence/OptimisticLockException.html" title="class in javax.persistence">OptimisticLockException</a></code> - if the optimistic version
check fails</dd>
<dd><code><a href="../../javax/persistence/PessimisticLockException.html" title="class in javax.persistence">PessimisticLockException</a></code> - if pessimistic locking
fails and the transaction is rolled back</dd>
<dd><code><a href="../../javax/persistence/LockTimeoutException.html" title="class in javax.persistence">LockTimeoutException</a></code> - if pessimistic locking fails and
only the statement is rolled back</dd>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if an unsupported lock call
is made</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="find-java.lang.Class-java.lang.Object-javax.persistence.LockModeType-java.util.Map-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>find</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;find(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</pre>
<div class="block">Find by primary key and lock, using the specified properties.
Search for an entity of the specified class and primary key
and lock it with respect to the specified lock type.
If the entity instance is contained in the persistence context,
it is returned from there.
<p> If the entity is found
within the persistence context and the lock mode type
is pessimistic and the entity has a version attribute, the
persistence provider must perform optimistic version checks
when obtaining the database lock. If these checks fail,
the <code>OptimisticLockException</code> will be thrown.
<p>If the lock mode type is pessimistic and the entity instance
is found but cannot be locked:
<ul>
<li> the <code>PessimisticLockException</code> will be thrown if the database
locking failure causes transaction-level rollback
<li> the <code>LockTimeoutException</code> will be thrown if the database
locking failure causes only statement-level rollback
</ul>
<p>If a vendor-specific property or hint is not recognized,
it is silently ignored.
<p>Portable applications should not rely on the standard timeout
hint. Depending on the database in use and the locking
mechanisms used by the provider, the hint may or may not
be observed.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entityClass</code> - entity class</dd>
<dd><code>primaryKey</code> - primary key</dd>
<dd><code>lockMode</code> - lock mode</dd>
<dd><code>properties</code> - standard and vendor-specific properties
and hints</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the found entity instance or null if the entity does
not exist</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the first argument does
not denote an entity type or the second argument is
not a valid type for that entity's primary key or
is null</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no
transaction and a lock mode other than <code>NONE</code> is
specified or if invoked on an entity manager which has
not been joined to the current transaction and a lock
mode other than <code>NONE</code> is specified</dd>
<dd><code><a href="../../javax/persistence/OptimisticLockException.html" title="class in javax.persistence">OptimisticLockException</a></code> - if the optimistic version
check fails</dd>
<dd><code><a href="../../javax/persistence/PessimisticLockException.html" title="class in javax.persistence">PessimisticLockException</a></code> - if pessimistic locking
fails and the transaction is rolled back</dd>
<dd><code><a href="../../javax/persistence/LockTimeoutException.html" title="class in javax.persistence">LockTimeoutException</a></code> - if pessimistic locking fails and
only the statement is rolled back</dd>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if an unsupported lock call
is made</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="getReference-java.lang.Class-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getReference</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;getReference(java.lang.Class&lt;T&gt;&nbsp;entityClass,
java.lang.Object&nbsp;primaryKey)</pre>
<div class="block">Get an instance, whose state may be lazily fetched.
If the requested instance does not exist in the database,
the <code>EntityNotFoundException</code> is thrown when the instance
state is first accessed. (The persistence provider runtime is
permitted to throw the <code>EntityNotFoundException</code> when
<code>getReference</code> is called.)
The application should not expect that the instance state will
be available upon detachment, unless it was accessed by the
application while the entity manager was open.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entityClass</code> - entity class</dd>
<dd><code>primaryKey</code> - primary key</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the found entity instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the first argument does
not denote an entity type or the second argument is
not a valid type for that entity's primary key or
is null</dd>
<dd><code><a href="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</a></code> - if the entity state
cannot be accessed</dd>
</dl>
</li>
</ul>
<a name="flush--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>flush</h4>
<pre>void&nbsp;flush()</pre>
<div class="block">Synchronize the persistence context to the
underlying database.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is
no transaction or if the entity manager has not been
joined to the current transaction</dd>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if the flush fails</dd>
</dl>
</li>
</ul>
<a name="setFlushMode-javax.persistence.FlushModeType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setFlushMode</h4>
<pre>void&nbsp;setFlushMode(<a href="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</a>&nbsp;flushMode)</pre>
<div class="block">Set the flush mode that applies to all objects contained
in the persistence context.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>flushMode</code> - flush mode</dd>
</dl>
</li>
</ul>
<a name="getFlushMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFlushMode</h4>
<pre><a href="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</a>&nbsp;getFlushMode()</pre>
<div class="block">Get the flush mode that applies to all objects contained
in the persistence context.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>flushMode</dd>
</dl>
</li>
</ul>
<a name="lock-java.lang.Object-javax.persistence.LockModeType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lock</h4>
<pre>void&nbsp;lock(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode)</pre>
<div class="block">Lock an entity instance that is contained in the persistence
context with the specified lock mode type.
<p>If a pessimistic lock mode type is specified and the entity
contains a version attribute, the persistence provider must
also perform optimistic version checks when obtaining the
database lock. If these checks fail, the
<code>OptimisticLockException</code> will be thrown.
<p>If the lock mode type is pessimistic and the entity instance
is found but cannot be locked:
<ul>
<li> the <code>PessimisticLockException</code> will be thrown if the database
locking failure causes transaction-level rollback
<li> the <code>LockTimeoutException</code> will be thrown if the database
locking failure causes only statement-level rollback
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dd><code>lockMode</code> - lock mode</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not an
entity or is a detached entity</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no
transaction or if invoked on an entity manager which
has not been joined to the current transaction</dd>
<dd><code><a href="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</a></code> - if the entity does not exist
in the database when pessimistic locking is
performed</dd>
<dd><code><a href="../../javax/persistence/OptimisticLockException.html" title="class in javax.persistence">OptimisticLockException</a></code> - if the optimistic version
check fails</dd>
<dd><code><a href="../../javax/persistence/PessimisticLockException.html" title="class in javax.persistence">PessimisticLockException</a></code> - if pessimistic locking fails
and the transaction is rolled back</dd>
<dd><code><a href="../../javax/persistence/LockTimeoutException.html" title="class in javax.persistence">LockTimeoutException</a></code> - if pessimistic locking fails and
only the statement is rolled back</dd>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if an unsupported lock call
is made</dd>
</dl>
</li>
</ul>
<a name="lock-java.lang.Object-javax.persistence.LockModeType-java.util.Map-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lock</h4>
<pre>void&nbsp;lock(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</pre>
<div class="block">Lock an entity instance that is contained in the persistence
context with the specified lock mode type and with specified
properties.
<p>If a pessimistic lock mode type is specified and the entity
contains a version attribute, the persistence provider must
also perform optimistic version checks when obtaining the
database lock. If these checks fail, the
<code>OptimisticLockException</code> will be thrown.
<p>If the lock mode type is pessimistic and the entity instance
is found but cannot be locked:
<ul>
<li> the <code>PessimisticLockException</code> will be thrown if the database
locking failure causes transaction-level rollback
<li> the <code>LockTimeoutException</code> will be thrown if the database
locking failure causes only statement-level rollback
</ul>
<p>If a vendor-specific property or hint is not recognized,
it is silently ignored.
<p>Portable applications should not rely on the standard timeout
hint. Depending on the database in use and the locking
mechanisms used by the provider, the hint may or may not
be observed.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dd><code>lockMode</code> - lock mode</dd>
<dd><code>properties</code> - standard and vendor-specific properties
and hints</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not an
entity or is a detached entity</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no
transaction or if invoked on an entity manager which
has not been joined to the current transaction</dd>
<dd><code><a href="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</a></code> - if the entity does not exist
in the database when pessimistic locking is
performed</dd>
<dd><code><a href="../../javax/persistence/OptimisticLockException.html" title="class in javax.persistence">OptimisticLockException</a></code> - if the optimistic version
check fails</dd>
<dd><code><a href="../../javax/persistence/PessimisticLockException.html" title="class in javax.persistence">PessimisticLockException</a></code> - if pessimistic locking fails
and the transaction is rolled back</dd>
<dd><code><a href="../../javax/persistence/LockTimeoutException.html" title="class in javax.persistence">LockTimeoutException</a></code> - if pessimistic locking fails and
only the statement is rolled back</dd>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if an unsupported lock call
is made</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="refresh-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>refresh</h4>
<pre>void&nbsp;refresh(java.lang.Object&nbsp;entity)</pre>
<div class="block">Refresh the state of the instance from the database,
overwriting changes made to the entity, if any.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not
an entity or the entity is not managed</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no
transaction when invoked on a container-managed
entity manager of type <code>PersistenceContextType.TRANSACTION</code></dd>
<dd><code><a href="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</a></code> - if the entity no longer
exists in the database</dd>
</dl>
</li>
</ul>
<a name="refresh-java.lang.Object-java.util.Map-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>refresh</h4>
<pre>void&nbsp;refresh(java.lang.Object&nbsp;entity,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</pre>
<div class="block">Refresh the state of the instance from the database, using
the specified properties, and overwriting changes made to
the entity, if any.
<p> If a vendor-specific property or hint is not recognized,
it is silently ignored.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dd><code>properties</code> - standard and vendor-specific properties
and hints</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not
an entity or the entity is not managed</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no
transaction when invoked on a container-managed
entity manager of type <code>PersistenceContextType.TRANSACTION</code></dd>
<dd><code><a href="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</a></code> - if the entity no longer
exists in the database</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="refresh-java.lang.Object-javax.persistence.LockModeType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>refresh</h4>
<pre>void&nbsp;refresh(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode)</pre>
<div class="block">Refresh the state of the instance from the database,
overwriting changes made to the entity, if any, and
lock it with respect to given lock mode type.
<p>If the lock mode type is pessimistic and the entity instance
is found but cannot be locked:
<ul>
<li> the <code>PessimisticLockException</code> will be thrown if the database
locking failure causes transaction-level rollback
<li> the <code>LockTimeoutException</code> will be thrown if the
database locking failure causes only statement-level
rollback.
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dd><code>lockMode</code> - lock mode</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not
an entity or the entity is not managed</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if invoked on a
container-managed entity manager of type
<code>PersistenceContextType.TRANSACTION</code> when there is
no transaction; if invoked on an extended entity manager when
there is no transaction and a lock mode other than <code>NONE</code>
has been specified; or if invoked on an extended entity manager
that has not been joined to the current transaction and a
lock mode other than <code>NONE</code> has been specified</dd>
<dd><code><a href="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</a></code> - if the entity no longer exists
in the database</dd>
<dd><code><a href="../../javax/persistence/PessimisticLockException.html" title="class in javax.persistence">PessimisticLockException</a></code> - if pessimistic locking fails
and the transaction is rolled back</dd>
<dd><code><a href="../../javax/persistence/LockTimeoutException.html" title="class in javax.persistence">LockTimeoutException</a></code> - if pessimistic locking fails and
only the statement is rolled back</dd>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if an unsupported lock call
is made</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="refresh-java.lang.Object-javax.persistence.LockModeType-java.util.Map-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>refresh</h4>
<pre>void&nbsp;refresh(java.lang.Object&nbsp;entity,
<a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;lockMode,
java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;properties)</pre>
<div class="block">Refresh the state of the instance from the database,
overwriting changes made to the entity, if any, and
lock it with respect to given lock mode type and with
specified properties.
<p>If the lock mode type is pessimistic and the entity instance
is found but cannot be locked:
<ul>
<li> the <code>PessimisticLockException</code> will be thrown if the database
locking failure causes transaction-level rollback
<li> the <code>LockTimeoutException</code> will be thrown if the database
locking failure causes only statement-level rollback
</ul>
<p>If a vendor-specific property or hint is not recognized,
it is silently ignored.
<p>Portable applications should not rely on the standard timeout
hint. Depending on the database in use and the locking
mechanisms used by the provider, the hint may or may not
be observed.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dd><code>lockMode</code> - lock mode</dd>
<dd><code>properties</code> - standard and vendor-specific properties
and hints</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not
an entity or the entity is not managed</dd>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if invoked on a
container-managed entity manager of type
<code>PersistenceContextType.TRANSACTION</code> when there is
no transaction; if invoked on an extended entity manager when
there is no transaction and a lock mode other than <code>NONE</code>
has been specified; or if invoked on an extended entity manager
that has not been joined to the current transaction and a
lock mode other than <code>NONE</code> has been specified</dd>
<dd><code><a href="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</a></code> - if the entity no longer exists
in the database</dd>
<dd><code><a href="../../javax/persistence/PessimisticLockException.html" title="class in javax.persistence">PessimisticLockException</a></code> - if pessimistic locking fails
and the transaction is rolled back</dd>
<dd><code><a href="../../javax/persistence/LockTimeoutException.html" title="class in javax.persistence">LockTimeoutException</a></code> - if pessimistic locking fails and
only the statement is rolled back</dd>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if an unsupported lock call
is made</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="clear--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clear</h4>
<pre>void&nbsp;clear()</pre>
<div class="block">Clear the persistence context, causing all managed
entities to become detached. Changes made to entities that
have not been flushed to the database will not be
persisted.</div>
</li>
</ul>
<a name="detach-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>detach</h4>
<pre>void&nbsp;detach(java.lang.Object&nbsp;entity)</pre>
<div class="block">Remove the given entity from the persistence context, causing
a managed entity to become detached. Unflushed changes made
to the entity if any (including removal of the entity),
will not be synchronized to the database. Entities which
previously referenced the detached entity will continue to
reference it.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not an
entity</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="contains-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>contains</h4>
<pre>boolean&nbsp;contains(java.lang.Object&nbsp;entity)</pre>
<div class="block">Check if the instance is a managed entity instance belonging
to the current persistence context.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>boolean indicating if entity is in persistence context</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if not an entity</dd>
</dl>
</li>
</ul>
<a name="getLockMode-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLockMode</h4>
<pre><a href="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</a>&nbsp;getLockMode(java.lang.Object&nbsp;entity)</pre>
<div class="block">Get the current lock mode for the entity instance.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entity</code> - entity instance</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>lock mode</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is no
transaction or if the entity manager has not been
joined to the current transaction</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if the instance is not a
managed entity and a transaction is active</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="setProperty-java.lang.String-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setProperty</h4>
<pre>void&nbsp;setProperty(java.lang.String&nbsp;propertyName,
java.lang.Object&nbsp;value)</pre>
<div class="block">Set an entity manager property or hint.
If a vendor-specific property or hint is not recognized, it is
silently ignored.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>propertyName</code> - name of property or hint</dd>
<dd><code>value</code> - value for property or hint</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the second argument is
not valid for the implementation</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="getProperties--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProperties</h4>
<pre>java.util.Map&lt;java.lang.String,java.lang.Object&gt;&nbsp;getProperties()</pre>
<div class="block">Get the properties and hints and associated values that are in effect
for the entity manager. Changing the contents of the map does
not change the configuration in effect.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>map of properties and hints in effect for entity manager</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="createQuery-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createQuery</h4>
<pre><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a>&nbsp;createQuery(java.lang.String&nbsp;qlString)</pre>
<div class="block">Create an instance of <code>Query</code> for executing a
Java Persistence query language statement.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>qlString</code> - a Java Persistence query string</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the query string is
found to be invalid</dd>
</dl>
</li>
</ul>
<a name="createQuery-javax.persistence.criteria.CriteriaQuery-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createQuery</h4>
<pre>&lt;T&gt;&nbsp;<a href="../../javax/persistence/TypedQuery.html" title="interface in javax.persistence">TypedQuery</a>&lt;T&gt;&nbsp;createQuery(<a href="../../javax/persistence/criteria/CriteriaQuery.html" title="interface in javax.persistence.criteria">CriteriaQuery</a>&lt;T&gt;&nbsp;criteriaQuery)</pre>
<div class="block">Create an instance of <code>TypedQuery</code> for executing a
criteria query.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>criteriaQuery</code> - a criteria query object</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the criteria query is
found to be invalid</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="createQuery-javax.persistence.criteria.CriteriaUpdate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createQuery</h4>
<pre><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a>&nbsp;createQuery(<a href="../../javax/persistence/criteria/CriteriaUpdate.html" title="interface in javax.persistence.criteria">CriteriaUpdate</a>&nbsp;updateQuery)</pre>
<div class="block">Create an instance of <code>Query</code> for executing a criteria
update query.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>updateQuery</code> - a criteria update query object</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the update query is
found to be invalid</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="createQuery-javax.persistence.criteria.CriteriaDelete-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createQuery</h4>
<pre><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a>&nbsp;createQuery(<a href="../../javax/persistence/criteria/CriteriaDelete.html" title="interface in javax.persistence.criteria">CriteriaDelete</a>&nbsp;deleteQuery)</pre>
<div class="block">Create an instance of <code>Query</code> for executing a criteria
delete query.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>deleteQuery</code> - a criteria delete query object</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the delete query is
found to be invalid</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="createQuery-java.lang.String-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createQuery</h4>
<pre>&lt;T&gt;&nbsp;<a href="../../javax/persistence/TypedQuery.html" title="interface in javax.persistence">TypedQuery</a>&lt;T&gt;&nbsp;createQuery(java.lang.String&nbsp;qlString,
java.lang.Class&lt;T&gt;&nbsp;resultClass)</pre>
<div class="block">Create an instance of <code>TypedQuery</code> for executing a
Java Persistence query language statement.
The select list of the query must contain only a single
item, which must be assignable to the type specified by
the <code>resultClass</code> argument.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>qlString</code> - a Java Persistence query string</dd>
<dd><code>resultClass</code> - the type of the query result</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the query string is found
to be invalid or if the query result is found to
not be assignable to the specified type</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="createNamedQuery-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createNamedQuery</h4>
<pre><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a>&nbsp;createNamedQuery(java.lang.String&nbsp;name)</pre>
<div class="block">Create an instance of <code>Query</code> for executing a named query
(in the Java Persistence query language or in native SQL).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of a query defined in metadata</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if a query has not been
defined with the given name or if the query string is
found to be invalid</dd>
</dl>
</li>
</ul>
<a name="createNamedQuery-java.lang.String-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createNamedQuery</h4>
<pre>&lt;T&gt;&nbsp;<a href="../../javax/persistence/TypedQuery.html" title="interface in javax.persistence">TypedQuery</a>&lt;T&gt;&nbsp;createNamedQuery(java.lang.String&nbsp;name,
java.lang.Class&lt;T&gt;&nbsp;resultClass)</pre>
<div class="block">Create an instance of <code>TypedQuery</code> for executing a
Java Persistence query language named query.
The select list of the query must contain only a single
item, which must be assignable to the type specified by
the <code>resultClass</code> argument.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of a query defined in metadata</dd>
<dd><code>resultClass</code> - the type of the query result</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if a query has not been
defined with the given name or if the query string is
found to be invalid or if the query result is found to
not be assignable to the specified type</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="createNativeQuery-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createNativeQuery</h4>
<pre><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a>&nbsp;createNativeQuery(java.lang.String&nbsp;sqlString)</pre>
<div class="block">Create an instance of <code>Query</code> for executing
a native SQL statement, e.g., for update or delete.
If the query is not an update or delete query, query
execution will result in each row of the SQL result
being returned as a result of type Object[] (or a result
of type Object if there is only one column in the select
list.) Column values are returned in the order of their
appearance in the select list and default JDBC type
mappings are applied.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sqlString</code> - a native SQL query string</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
</dl>
</li>
</ul>
<a name="createNativeQuery-java.lang.String-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createNativeQuery</h4>
<pre><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a>&nbsp;createNativeQuery(java.lang.String&nbsp;sqlString,
java.lang.Class&nbsp;resultClass)</pre>
<div class="block">Create an instance of <code>Query</code> for executing
a native SQL query.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sqlString</code> - a native SQL query string</dd>
<dd><code>resultClass</code> - the class of the resulting instance(s)</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
</dl>
</li>
</ul>
<a name="createNativeQuery-java.lang.String-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createNativeQuery</h4>
<pre><a href="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</a>&nbsp;createNativeQuery(java.lang.String&nbsp;sqlString,
java.lang.String&nbsp;resultSetMapping)</pre>
<div class="block">Create an instance of <code>Query</code> for executing
a native SQL query.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sqlString</code> - a native SQL query string</dd>
<dd><code>resultSetMapping</code> - the name of the result set mapping</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new query instance</dd>
</dl>
</li>
</ul>
<a name="createNamedStoredProcedureQuery-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createNamedStoredProcedureQuery</h4>
<pre><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a>&nbsp;createNamedStoredProcedureQuery(java.lang.String&nbsp;name)</pre>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.
<p>Parameters must be registered before the stored procedure can
be executed.
<p>If the stored procedure returns one or more result sets,
any result set will be returned as a list of type Object[].</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - name assigned to the stored procedure query
in metadata</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new stored procedure query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if a query has not been
defined with the given name</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="createStoredProcedureQuery-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createStoredProcedureQuery</h4>
<pre><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a>&nbsp;createStoredProcedureQuery(java.lang.String&nbsp;procedureName)</pre>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.
<p>Parameters must be registered before the stored procedure can
be executed.
<p>If the stored procedure returns one or more result sets,
any result set will be returned as a list of type Object[].</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>procedureName</code> - name of the stored procedure in the
database</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new stored procedure query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if a stored procedure of the
given name does not exist (or the query execution will
fail)</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="createStoredProcedureQuery-java.lang.String-java.lang.Class...-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createStoredProcedureQuery</h4>
<pre><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a>&nbsp;createStoredProcedureQuery(java.lang.String&nbsp;procedureName,
java.lang.Class...&nbsp;resultClasses)</pre>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.
<p>Parameters must be registered before the stored procedure can
be executed.
<p>The <code>resultClass</code> arguments must be specified in the order in
which the result sets will be returned by the stored procedure
invocation.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>procedureName</code> - name of the stored procedure in the
database</dd>
<dd><code>resultClasses</code> - classes to which the result sets
produced by the stored procedure are to
be mapped</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new stored procedure query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if a stored procedure of the
given name does not exist (or the query execution will
fail)</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="createStoredProcedureQuery-java.lang.String-java.lang.String...-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createStoredProcedureQuery</h4>
<pre><a href="../../javax/persistence/StoredProcedureQuery.html" title="interface in javax.persistence">StoredProcedureQuery</a>&nbsp;createStoredProcedureQuery(java.lang.String&nbsp;procedureName,
java.lang.String...&nbsp;resultSetMappings)</pre>
<div class="block">Create an instance of <code>StoredProcedureQuery</code> for executing a
stored procedure in the database.
<p>Parameters must be registered before the stored procedure can
be executed.
<p>The <code>resultSetMapping</code> arguments must be specified in the order
in which the result sets will be returned by the stored
procedure invocation.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>procedureName</code> - name of the stored procedure in the
database</dd>
<dd><code>resultSetMappings</code> - the names of the result set mappings
to be used in mapping result sets
returned by the stored procedure</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new stored procedure query instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if a stored procedure or
result set mapping of the given name does not exist
(or the query execution will fail)</dd>
</dl>
</li>
</ul>
<a name="joinTransaction--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>joinTransaction</h4>
<pre>void&nbsp;joinTransaction()</pre>
<div class="block">Indicate to the entity manager that a JTA transaction is
active and join the persistence context to it.
<p>This method should be called on a JTA application
managed entity manager that was created outside the scope
of the active transaction or on an entity manager of type
<code>SynchronizationType.UNSYNCHRONIZED</code> to associate
it with the current JTA transaction.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</a></code> - if there is
no transaction</dd>
</dl>
</li>
</ul>
<a name="isJoinedToTransaction--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isJoinedToTransaction</h4>
<pre>boolean&nbsp;isJoinedToTransaction()</pre>
<div class="block">Determine whether the entity manager is joined to the
current transaction. Returns false if the entity manager
is not joined to the current transaction or if no
transaction is active</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>boolean</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="unwrap-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>unwrap</h4>
<pre>&lt;T&gt;&nbsp;T&nbsp;unwrap(java.lang.Class&lt;T&gt;&nbsp;cls)</pre>
<div class="block">Return an object of the specified type to allow access to the
provider-specific API. If the provider's <code>EntityManager</code>
implementation does not support the specified class, the
<code>PersistenceException</code> is thrown.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cls</code> - the class of the object to be returned. This is
normally either the underlying <code>EntityManager</code> implementation
class or an interface that it implements.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an instance of the specified class</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</a></code> - if the provider does not
support the call</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="getDelegate--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDelegate</h4>
<pre>java.lang.Object&nbsp;getDelegate()</pre>
<div class="block">Return the underlying provider object for the <code>EntityManager</code>,
if available. The result of this method is implementation
specific.
<p>The <code>unwrap</code> method is to be preferred for new applications.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>underlying provider object for EntityManager</dd>
</dl>
</li>
</ul>
<a name="close--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>void&nbsp;close()</pre>
<div class="block">Close an application-managed entity manager.
After the close method has been invoked, all methods
on the <code>EntityManager</code> instance and any
<code>Query</code>, <code>TypedQuery</code>, and
<code>StoredProcedureQuery</code> objects obtained from
it will throw the <code>IllegalStateException</code>
except for <code>getProperties</code>,
<code>getTransaction</code>, and <code>isOpen</code> (which will return false).
If this method is called when the entity manager is
joined to an active transaction, the persistence
context remains managed until the transaction completes.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if the entity manager
is container-managed</dd>
</dl>
</li>
</ul>
<a name="isOpen--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isOpen</h4>
<pre>boolean&nbsp;isOpen()</pre>
<div class="block">Determine whether the entity manager is open.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true until the entity manager has been closed</dd>
</dl>
</li>
</ul>
<a name="getTransaction--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransaction</h4>
<pre><a href="../../javax/persistence/EntityTransaction.html" title="interface in javax.persistence">EntityTransaction</a>&nbsp;getTransaction()</pre>
<div class="block">Return the resource-level <code>EntityTransaction</code> object.
The <code>EntityTransaction</code> instance may be used serially to
begin and commit multiple transactions.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>EntityTransaction instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if invoked on a JTA
entity manager</dd>
</dl>
</li>
</ul>
<a name="getEntityManagerFactory--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEntityManagerFactory</h4>
<pre><a href="../../javax/persistence/EntityManagerFactory.html" title="interface in javax.persistence">EntityManagerFactory</a>&nbsp;getEntityManagerFactory()</pre>
<div class="block">Return the entity manager factory for the entity manager.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>EntityManagerFactory instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if the entity manager has
been closed</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="getCriteriaBuilder--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCriteriaBuilder</h4>
<pre><a href="../../javax/persistence/criteria/CriteriaBuilder.html" title="interface in javax.persistence.criteria">CriteriaBuilder</a>&nbsp;getCriteriaBuilder()</pre>
<div class="block">Return an instance of <code>CriteriaBuilder</code> for the creation of
<code>CriteriaQuery</code> objects.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>CriteriaBuilder instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if the entity manager has
been closed</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="getMetamodel--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMetamodel</h4>
<pre><a href="../../javax/persistence/metamodel/Metamodel.html" title="interface in javax.persistence.metamodel">Metamodel</a>&nbsp;getMetamodel()</pre>
<div class="block">Return an instance of <code>Metamodel</code> interface for access to the
metamodel of the persistence unit.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Metamodel instance</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if the entity manager has
been closed</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.0</dd>
</dl>
</li>
</ul>
<a name="createEntityGraph-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createEntityGraph</h4>
<pre>&lt;T&gt;&nbsp;<a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;T&gt;&nbsp;createEntityGraph(java.lang.Class&lt;T&gt;&nbsp;rootType)</pre>
<div class="block">Return a mutable EntityGraph that can be used to dynamically create an
EntityGraph.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>rootType</code> - class of entity graph</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>entity graph</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="createEntityGraph-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createEntityGraph</h4>
<pre><a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;?&gt;&nbsp;createEntityGraph(java.lang.String&nbsp;graphName)</pre>
<div class="block">Return a mutable copy of the named EntityGraph. If there
is no entity graph with the specified name, null is returned.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>graphName</code> - name of an entity graph</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>entity graph</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="getEntityGraph-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEntityGraph</h4>
<pre><a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;?&gt;&nbsp;getEntityGraph(java.lang.String&nbsp;graphName)</pre>
<div class="block">Return a named EntityGraph. The returned EntityGraph
should be considered immutable.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>graphName</code> - name of an existing entity graph</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>named entity graph</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if there is no EntityGraph of
the given name</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</li>
</ul>
<a name="getEntityGraphs-java.lang.Class-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getEntityGraphs</h4>
<pre>&lt;T&gt;&nbsp;java.util.List&lt;<a href="../../javax/persistence/EntityGraph.html" title="interface in javax.persistence">EntityGraph</a>&lt;? super T&gt;&gt;&nbsp;getEntityGraphs(java.lang.Class&lt;T&gt;&nbsp;entityClass)</pre>
<div class="block">Return all named EntityGraphs that have been defined for the provided
class type.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>entityClass</code> - entity class</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>list of all entity graphs defined for the entity</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the class is not an entity</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Java Persistence 2.1</dd>
</dl>
</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>
<div class="subNav">
<ul class="navList">
<li><a href="../../javax/persistence/EntityListeners.html" title="annotation in javax.persistence"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../javax/persistence/EntityManagerFactory.html" title="interface in javax.persistence"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?javax/persistence/EntityManager.html" target="_top">Frames</a></li>
<li><a href="EntityManager.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>