| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!--NewPage--> |
| <HTML> |
| <HEAD> |
| <!-- Generated by javadoc (build 1.6.0) on Fri Sep 25 03:18:13 EDT 2009 --> |
| <TITLE> |
| EntityManager (EclipseLink 1.1.3, build 'v20090925-r5281' API Reference) |
| </TITLE> |
| |
| <META NAME="date" CONTENT="2009-09-25"> |
| |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> |
| |
| <SCRIPT type="text/javascript"> |
| function windowTitle() |
| { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="EntityManager (EclipseLink 1.1.3, build 'v20090925-r5281' API Reference)"; |
| } |
| } |
| </SCRIPT> |
| <NOSCRIPT> |
| </NOSCRIPT> |
| |
| </HEAD> |
| |
| <BODY BGCOLOR="white" onload="windowTitle();"> |
| <HR> |
| |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <A NAME="navbar_top"><!-- --></A> |
| <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_top_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../serialized-form.html"><FONT CLASS="NavBarFont1"><B>Serialized</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| EclipseLink 1.1.3, build 'v20090925-r5281' API Reference</EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../javax/persistence/EntityListeners.html" title="annotation in javax.persistence"><B>PREV CLASS</B></A> |
| <A HREF="../../javax/persistence/EntityManagerFactory.html" title="interface in javax.persistence"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../index.html?javax/persistence/EntityManager.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="EntityManager.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_top"></A> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| |
| <HR> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <H2> |
| <FONT SIZE="-1"> |
| javax.persistence</FONT> |
| <BR> |
| Interface EntityManager</H2> |
| <DL> |
| <DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../org/eclipse/persistence/jpa/JpaEntityManager.html" title="interface in org.eclipse.persistence.jpa">JpaEntityManager</A></DD> |
| </DL> |
| <HR> |
| <DL> |
| <DT><PRE>public interface <B>EntityManager</B></DL> |
| </PRE> |
| |
| <P> |
| 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. This interface |
| defines the methods that are used to interact with the |
| persistence context. 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. |
| <P> |
| |
| <P> |
| <DL> |
| <DT><B>Since:</B></DT> |
| <DD>Java Persistence 1.0</DD> |
| </DL> |
| <HR> |
| |
| <P> |
| |
| <!-- ========== METHOD SUMMARY =========== --> |
| |
| <A NAME="method_summary"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| <B>Method Summary</B></FONT></TH> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#clear()">clear</A></B>()</CODE> |
| |
| <BR> |
| Clear the persistence context, causing all managed |
| entities to become detached.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#close()">close</A></B>()</CODE> |
| |
| <BR> |
| Close an application-managed EntityManager.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#contains(java.lang.Object)">contains</A></B>(java.lang.Object entity)</CODE> |
| |
| <BR> |
| Check if the instance belongs to the current persistence |
| context.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#createNamedQuery(java.lang.String)">createNamedQuery</A></B>(java.lang.String name)</CODE> |
| |
| <BR> |
| Create an instance of Query for executing a |
| named query (in the Java Persistence query language or in native SQL).</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#createNativeQuery(java.lang.String)">createNativeQuery</A></B>(java.lang.String sqlString)</CODE> |
| |
| <BR> |
| Create an instance of Query for executing |
| a native SQL statement, e.g., for update or delete.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#createNativeQuery(java.lang.String, java.lang.Class)">createNativeQuery</A></B>(java.lang.String sqlString, |
| java.lang.Class resultClass)</CODE> |
| |
| <BR> |
| Create an instance of Query for executing |
| a native SQL query.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#createNativeQuery(java.lang.String, java.lang.String)">createNativeQuery</A></B>(java.lang.String sqlString, |
| java.lang.String resultSetMapping)</CODE> |
| |
| <BR> |
| Create an instance of Query for executing |
| a native SQL query.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#createQuery(java.lang.String)">createQuery</A></B>(java.lang.String qlString)</CODE> |
| |
| <BR> |
| Create an instance of Query for executing a |
| Java Persistence query language statement.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> T</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#find(java.lang.Class, java.lang.Object)">find</A></B>(java.lang.Class<T> entityClass, |
| java.lang.Object primaryKey)</CODE> |
| |
| <BR> |
| Find by primary key.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#flush()">flush</A></B>()</CODE> |
| |
| <BR> |
| Synchronize the persistence context to the |
| underlying database.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> java.lang.Object</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#getDelegate()">getDelegate</A></B>()</CODE> |
| |
| <BR> |
| Return the underlying provider object for the EntityManager, |
| if available.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#getFlushMode()">getFlushMode</A></B>()</CODE> |
| |
| <BR> |
| Get the flush mode that applies to all objects contained |
| in the persistence context.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> T</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#getReference(java.lang.Class, java.lang.Object)">getReference</A></B>(java.lang.Class<T> entityClass, |
| java.lang.Object primaryKey)</CODE> |
| |
| <BR> |
| Get an instance, whose state may be lazily fetched.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> <A HREF="../../javax/persistence/EntityTransaction.html" title="interface in javax.persistence">EntityTransaction</A></CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#getTransaction()">getTransaction</A></B>()</CODE> |
| |
| <BR> |
| Returns the resource-level transaction object.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> boolean</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#isOpen()">isOpen</A></B>()</CODE> |
| |
| <BR> |
| Determine whether the EntityManager is open.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#joinTransaction()">joinTransaction</A></B>()</CODE> |
| |
| <BR> |
| Indicate to the EntityManager that a JTA transaction is |
| active.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#lock(java.lang.Object, javax.persistence.LockModeType)">lock</A></B>(java.lang.Object entity, |
| <A HREF="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</A> lockMode)</CODE> |
| |
| <BR> |
| Set the lock mode for an entity object contained |
| in the persistence context.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> |
| <TR ALIGN="right" VALIGN=""> |
| <TD NOWRAP><FONT SIZE="-1"> |
| <CODE><T> T</CODE></FONT></TD> |
| </TR> |
| </TABLE> |
| </CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#merge(T)">merge</A></B>(T entity)</CODE> |
| |
| <BR> |
| Merge the state of the given entity into the |
| current persistence context.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#persist(java.lang.Object)">persist</A></B>(java.lang.Object entity)</CODE> |
| |
| <BR> |
| Make an entity instance managed and persistent.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#refresh(java.lang.Object)">refresh</A></B>(java.lang.Object entity)</CODE> |
| |
| <BR> |
| Refresh the state of the instance from the database, |
| overwriting changes made to the entity, if any.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#remove(java.lang.Object)">remove</A></B>(java.lang.Object entity)</CODE> |
| |
| <BR> |
| Remove the entity instance.</TD> |
| </TR> |
| <TR BGCOLOR="white" CLASS="TableRowColor"> |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> |
| <CODE> void</CODE></FONT></TD> |
| <TD><CODE><B><A HREF="../../javax/persistence/EntityManager.html#setFlushMode(javax.persistence.FlushModeType)">setFlushMode</A></B>(<A HREF="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</A> flushMode)</CODE> |
| |
| <BR> |
| Set the flush mode that applies to all objects contained |
| in the persistence context.</TD> |
| </TR> |
| </TABLE> |
| |
| <P> |
| |
| <!-- ============ METHOD DETAIL ========== --> |
| |
| <A NAME="method_detail"><!-- --></A> |
| <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> |
| <B>Method Detail</B></FONT></TH> |
| </TR> |
| </TABLE> |
| |
| <A NAME="persist(java.lang.Object)"><!-- --></A><H3> |
| persist</H3> |
| <PRE> |
| void <B>persist</B>(java.lang.Object entity)</PRE> |
| <DL> |
| <DD>Make an entity instance managed and persistent. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entity</CODE> - |
| <DT><B>Throws:</B> |
| <DD><CODE><A HREF="../../javax/persistence/EntityExistsException.html" title="class in javax.persistence">EntityExistsException</A></CODE> - if the entity already exists. |
| (The EntityExistsException may be thrown when the persist |
| operation is invoked, or the EntityExistsException or |
| another PersistenceException may be thrown at flush or commit |
| time.) |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if not an entity |
| <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 |
| PersistenceContextType.TRANSACTION and there is |
| no transaction.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="merge(java.lang.Object)"><!-- --></A><A NAME="merge(T)"><!-- --></A><H3> |
| merge</H3> |
| <PRE> |
| <T> T <B>merge</B>(T entity)</PRE> |
| <DL> |
| <DD>Merge the state of the given entity into the |
| current persistence context. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entity</CODE> - |
| <DT><B>Returns:</B><DD>the instance that the state was merged to |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if instance is not an |
| entity or is a removed entity |
| <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 |
| PersistenceContextType.TRANSACTION and there is |
| no transaction.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="remove(java.lang.Object)"><!-- --></A><H3> |
| remove</H3> |
| <PRE> |
| void <B>remove</B>(java.lang.Object entity)</PRE> |
| <DL> |
| <DD>Remove the entity instance. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entity</CODE> - |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if not an entity |
| or if a detached entity |
| <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 |
| PersistenceContextType.TRANSACTION and there is |
| no transaction.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="find(java.lang.Class, java.lang.Object)"><!-- --></A><H3> |
| find</H3> |
| <PRE> |
| <T> T <B>find</B>(java.lang.Class<T> entityClass, |
| java.lang.Object primaryKey)</PRE> |
| <DL> |
| <DD>Find by primary key. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entityClass</CODE> - <DD><CODE>primaryKey</CODE> - |
| <DT><B>Returns:</B><DD>the found entity instance or null |
| if the entity does not exist |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <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</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getReference(java.lang.Class, java.lang.Object)"><!-- --></A><H3> |
| getReference</H3> |
| <PRE> |
| <T> T <B>getReference</B>(java.lang.Class<T> entityClass, |
| java.lang.Object primaryKey)</PRE> |
| <DL> |
| <DD>Get an instance, whose state may be lazily fetched. |
| If the requested instance does not exist in the database, |
| throws <A HREF="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence"><CODE>EntityNotFoundException</CODE></A> when the instance state is |
| first accessed. (The persistence provider runtime is permitted to throw |
| <A HREF="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence"><CODE>EntityNotFoundException</CODE></A> when <A HREF="../../javax/persistence/EntityManager.html#getReference(java.lang.Class, java.lang.Object)"><CODE>getReference(java.lang.Class<T>, java.lang.Object)</CODE></A> 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. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entityClass</CODE> - <DD><CODE>primaryKey</CODE> - |
| <DT><B>Returns:</B><DD>the found entity instance |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <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 |
| <DD><CODE><A HREF="../../javax/persistence/EntityNotFoundException.html" title="class in javax.persistence">EntityNotFoundException</A></CODE> - if the entity state |
| cannot be accessed</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="flush()"><!-- --></A><H3> |
| flush</H3> |
| <PRE> |
| void <B>flush</B>()</PRE> |
| <DL> |
| <DD>Synchronize the persistence context to the |
| underlying database. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE><A HREF="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</A></CODE> - if there is |
| no transaction |
| <DD><CODE><A HREF="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</A></CODE> - if the flush fails</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="setFlushMode(javax.persistence.FlushModeType)"><!-- --></A><H3> |
| setFlushMode</H3> |
| <PRE> |
| void <B>setFlushMode</B>(<A HREF="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</A> flushMode)</PRE> |
| <DL> |
| <DD>Set the flush mode that applies to all objects contained |
| in the persistence context. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>flushMode</CODE> - |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getFlushMode()"><!-- --></A><H3> |
| getFlushMode</H3> |
| <PRE> |
| <A HREF="../../javax/persistence/FlushModeType.html" title="enum in javax.persistence">FlushModeType</A> <B>getFlushMode</B>()</PRE> |
| <DL> |
| <DD>Get the flush mode that applies to all objects contained |
| in the persistence context. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>flush mode |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="lock(java.lang.Object, javax.persistence.LockModeType)"><!-- --></A><H3> |
| lock</H3> |
| <PRE> |
| void <B>lock</B>(java.lang.Object entity, |
| <A HREF="../../javax/persistence/LockModeType.html" title="enum in javax.persistence">LockModeType</A> lockMode)</PRE> |
| <DL> |
| <DD>Set the lock mode for an entity object contained |
| in the persistence context. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entity</CODE> - <DD><CODE>lockMode</CODE> - |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE><A HREF="../../javax/persistence/PersistenceException.html" title="class in javax.persistence">PersistenceException</A></CODE> - if an unsupported lock call |
| is made |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if the instance is not |
| an entity or is a detached entity |
| <DD><CODE><A HREF="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</A></CODE> - if there is no |
| transaction</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="refresh(java.lang.Object)"><!-- --></A><H3> |
| refresh</H3> |
| <PRE> |
| void <B>refresh</B>(java.lang.Object entity)</PRE> |
| <DL> |
| <DD>Refresh the state of the instance from the database, |
| overwriting changes made to the entity, if any. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entity</CODE> - |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if not an entity |
| or entity is not managed |
| <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 |
| PersistenceContextType.TRANSACTION and there is |
| no transaction. |
| <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.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="clear()"><!-- --></A><H3> |
| clear</H3> |
| <PRE> |
| void <B>clear</B>()</PRE> |
| <DL> |
| <DD>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. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="contains(java.lang.Object)"><!-- --></A><H3> |
| contains</H3> |
| <PRE> |
| boolean <B>contains</B>(java.lang.Object entity)</PRE> |
| <DL> |
| <DD>Check if the instance belongs to the current persistence |
| context. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>entity</CODE> - |
| <DT><B>Returns:</B><DD><code>true</code> if the instance belongs to |
| the current persistence context. |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if not an entity</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="createQuery(java.lang.String)"><!-- --></A><H3> |
| createQuery</H3> |
| <PRE> |
| <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A> <B>createQuery</B>(java.lang.String qlString)</PRE> |
| <DL> |
| <DD>Create an instance of Query for executing a |
| Java Persistence query language statement. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>qlString</CODE> - a Java Persistence query language query string |
| <DT><B>Returns:</B><DD>the new query instance |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if query string is not valid</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="createNamedQuery(java.lang.String)"><!-- --></A><H3> |
| createNamedQuery</H3> |
| <PRE> |
| <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A> <B>createNamedQuery</B>(java.lang.String name)</PRE> |
| <DL> |
| <DD>Create an instance of Query for executing a |
| named query (in the Java Persistence query language or in native SQL). |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of a query defined in metadata |
| <DT><B>Returns:</B><DD>the new query instance |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE>java.lang.IllegalArgumentException</CODE> - if a query has not been |
| defined with the given name</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="createNativeQuery(java.lang.String)"><!-- --></A><H3> |
| createNativeQuery</H3> |
| <PRE> |
| <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A> <B>createNativeQuery</B>(java.lang.String sqlString)</PRE> |
| <DL> |
| <DD>Create an instance of Query for executing |
| a native SQL statement, e.g., for update or delete. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>sqlString</CODE> - a native SQL query string |
| <DT><B>Returns:</B><DD>the new query instance |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="createNativeQuery(java.lang.String, java.lang.Class)"><!-- --></A><H3> |
| createNativeQuery</H3> |
| <PRE> |
| <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A> <B>createNativeQuery</B>(java.lang.String sqlString, |
| java.lang.Class resultClass)</PRE> |
| <DL> |
| <DD>Create an instance of Query for executing |
| a native SQL query. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>sqlString</CODE> - a native SQL query string<DD><CODE>resultClass</CODE> - the class of the resulting instance(s) |
| <DT><B>Returns:</B><DD>the new query instance |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="createNativeQuery(java.lang.String, java.lang.String)"><!-- --></A><H3> |
| createNativeQuery</H3> |
| <PRE> |
| <A HREF="../../javax/persistence/Query.html" title="interface in javax.persistence">Query</A> <B>createNativeQuery</B>(java.lang.String sqlString, |
| java.lang.String resultSetMapping)</PRE> |
| <DL> |
| <DD>Create an instance of Query for executing |
| a native SQL query. |
| <P> |
| <DD><DL> |
| <DT><B>Parameters:</B><DD><CODE>sqlString</CODE> - a native SQL query string<DD><CODE>resultSetMapping</CODE> - the name of the result set mapping |
| <DT><B>Returns:</B><DD>the new query instance |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="joinTransaction()"><!-- --></A><H3> |
| joinTransaction</H3> |
| <PRE> |
| void <B>joinTransaction</B>()</PRE> |
| <DL> |
| <DD>Indicate to the EntityManager that a JTA transaction is |
| active. This method should be called on a JTA application |
| managed EntityManager that was created outside the scope |
| of the active transaction to associate it with the current |
| JTA transaction. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed. |
| <DD><CODE><A HREF="../../javax/persistence/TransactionRequiredException.html" title="class in javax.persistence">TransactionRequiredException</A></CODE> - if there is |
| no transaction.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getDelegate()"><!-- --></A><H3> |
| getDelegate</H3> |
| <PRE> |
| java.lang.Object <B>getDelegate</B>()</PRE> |
| <DL> |
| <DD>Return the underlying provider object for the EntityManager, |
| if available. The result of this method is implementation |
| specific. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if this EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="close()"><!-- --></A><H3> |
| close</H3> |
| <PRE> |
| void <B>close</B>()</PRE> |
| <DL> |
| <DD>Close an application-managed EntityManager. |
| After the close method has been invoked, all methods |
| on the EntityManager instance and any Query objects obtained |
| from it will throw the IllegalStateException except |
| for getTransaction and isOpen (which will return false). |
| If this method is called when the EntityManager is |
| associated with an active transaction, the persistence |
| context remains managed until the transaction completes. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if the EntityManager |
| is container-managed or has been already closed..</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="isOpen()"><!-- --></A><H3> |
| isOpen</H3> |
| <PRE> |
| boolean <B>isOpen</B>()</PRE> |
| <DL> |
| <DD>Determine whether the EntityManager is open. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>true until the EntityManager has been closed.</DL> |
| </DD> |
| </DL> |
| <HR> |
| |
| <A NAME="getTransaction()"><!-- --></A><H3> |
| getTransaction</H3> |
| <PRE> |
| <A HREF="../../javax/persistence/EntityTransaction.html" title="interface in javax.persistence">EntityTransaction</A> <B>getTransaction</B>()</PRE> |
| <DL> |
| <DD>Returns the resource-level transaction object. |
| The EntityTransaction instance may be used serially to |
| begin and commit multiple transactions. |
| <P> |
| <DD><DL> |
| |
| <DT><B>Returns:</B><DD>EntityTransaction instance |
| <DT><B>Throws:</B> |
| <DD><CODE>java.lang.IllegalStateException</CODE> - if invoked on a JTA |
| EntityManager.</DL> |
| </DD> |
| </DL> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <HR> |
| |
| |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <A NAME="navbar_bottom"><!-- --></A> |
| <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_bottom_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../serialized-form.html"><FONT CLASS="NavBarFont1"><B>Serialized</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| EclipseLink 1.1.3, build 'v20090925-r5281' API Reference</EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../javax/persistence/EntityListeners.html" title="annotation in javax.persistence"><B>PREV CLASS</B></A> |
| <A HREF="../../javax/persistence/EntityManagerFactory.html" title="interface in javax.persistence"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../index.html?javax/persistence/EntityManager.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="EntityManager.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| |
| <HR> |
| |
| </BODY> |
| </HTML> |