entitymanager.html
来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 866 行 · 第 1/3 页
HTML
866 行
<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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this EntityManager has been closed.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this EntityManager has been closed.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this EntityManager has been closed.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><T> entityClass, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this EntityManager has been closed.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A><T> entityClass, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this EntityManager has been closed.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> 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><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalStateException.html" title="class or interface in java.lang">IllegalStateException</A></CODE> - if this EntityManager has been closed.<DD><CODE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?