entitymanager.html

来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 866 行 · 第 1/3 页

HTML
866
字号
 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><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="contains(java.lang.Object)"><!-- --></A><H3>contains</H3><PRE>boolean <B>contains</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>&nbsp;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><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</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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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><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 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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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><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 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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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><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="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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;sqlString,                        <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Class.html" title="class or interface in java.lang">Class</A>&nbsp;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><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="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>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;sqlString,                        <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>&nbsp;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><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="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><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.</DL></DD></DL><HR><A NAME="getDelegate()"><!-- --></A><H3>getDelegate</H3><PRE><A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/Object.html" title="class or interface in java.lang">Object</A> <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><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="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><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 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><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 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>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../javax/persistence/EntityListeners.html" title="annotation in javax.persistence"><B>PREV CLASS</B></A>&nbsp;&nbsp;<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>  &nbsp;&nbsp;<A HREF="EntityManager.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;&nbsp;<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:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><font size="-1"><a href="http://java.sun.com/webapps/bugreport">Submit a bug or feature</a> <p>Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../legal/license.html" target="_top">license terms.</a></font></BODY></HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?