📄 query.html
字号:
<!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.4.2_11) on Thu Nov 16 16:41:07 CST 2006 -->
<TITLE>
Query (Hibernate API Documentation)
</TITLE>
<META NAME="keywords" CONTENT="org.hibernate.Query interface">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../jdstyle.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Query (Hibernate API Documentation)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= 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=3 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="class-use/Query.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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="../../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>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../org/hibernate/Interceptor.html" title="interface in org.hibernate"><B>PREV CLASS</B></A>
<A HREF="../../org/hibernate/ScrollableResults.html" title="interface in org.hibernate"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="Query.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">
org.hibernate</FONT>
<BR>
Interface Query</H2>
<DL>
<DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../org/hibernate/SQLQuery.html" title="interface in org.hibernate">SQLQuery</A></DD>
</DL>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../org/hibernate/impl/AbstractQueryImpl.html" title="class in org.hibernate.impl">AbstractQueryImpl</A>, <A HREF="../../org/hibernate/impl/SQLQueryImpl.html" title="class in org.hibernate.impl">SQLQueryImpl</A></DD>
</DL>
<HR>
<DL>
<DT>public interface <B>Query</B></DL>
<P>
An object-oriented representation of a Hibernate query. A <tt>Query</tt> instance is obtained by calling <tt>Session.createQuery()</tt>. This interface exposes some extra functionality beyond that provided by <tt>Session.iterate()</tt> and <tt>Session.find()</tt>: <ul> <li>a particular page of the result set may be selected by calling <tt> setMaxResults(), setFirstResult()</tt> <li>named query parameters may be used <li>the results may be returned as an instance of <tt>ScrollableResults</tt> </ul> <br> Named query parameters are tokens of the form <tt>:name</tt> in the query string. A value is bound to the <tt>integer</tt> parameter <tt>:foo</tt> by calling<br> <br> <tt>setParameter("foo", foo, Hibernate.INTEGER);</tt><br> <br> for example. A name may appear multiple times in the query string.<br> <br> JDBC-style <tt>?</tt> parameters are also supported. To bind a value to a JDBC-style parameter use a set method that accepts an <tt>int</tt> positional argument (numbered from zero, contrary to JDBC).<br> <br> You may not mix and match JDBC-style parameters and named parameters in the same query.<br> <br> Queries are executed by calling <tt>list()</tt>, <tt>scroll()</tt> or <tt>iterate()</tt>. A query may be re-executed by subsequent invocations. Its lifespan is, however, bounded by the lifespan of the <tt>Session</tt> that created it.<br> <br> Implementors are not intended to be threadsafe.
<P>
<P>
<DL>
<DT><B>Author:</B></DT> <DD>Gavin King</DD><DT><B>See Also:</B><DD><A HREF="../../org/hibernate/Session.html#createQuery(java.lang.String)"><CODE>Session.createQuery(java.lang.String)</CODE></A>, <A HREF="../../org/hibernate/ScrollableResults.html" title="interface in org.hibernate"><CODE>ScrollableResults</CODE></A></DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#executeUpdate()">executeUpdate</A></B>()</CODE>
<BR>
Execute the update or delete statement.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#getNamedParameters()">getNamedParameters</A></B>()</CODE>
<BR>
Return the names of all named parameters of the query.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#getQueryString()">getQueryString</A></B>()</CODE>
<BR>
Get the query string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#getReturnAliases()">getReturnAliases</A></B>()</CODE>
<BR>
Return the HQL select clause aliases (if any)</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../org/hibernate/type/Type.html" title="interface in org.hibernate.type">Type</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#getReturnTypes()">getReturnTypes</A></B>()</CODE>
<BR>
Return the Hibernate types of the query result set.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/Iterator.html" title="class or interface in java.util">Iterator</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#iterate()">iterate</A></B>()</CODE>
<BR>
Return the query results as an <tt>Iterator</tt>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/util/List.html" title="class or interface in java.util">List</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#list()">list</A></B>()</CODE>
<BR>
Return the query results as a <tt>List</tt>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../org/hibernate/ScrollableResults.html" title="interface in org.hibernate">ScrollableResults</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#scroll()">scroll</A></B>()</CODE>
<BR>
Return the query results as <tt>ScrollableResults</tt>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../org/hibernate/ScrollableResults.html" title="interface in org.hibernate">ScrollableResults</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#scroll(org.hibernate.ScrollMode)">scroll</A></B>(<A HREF="../../org/hibernate/ScrollMode.html" title="class in org.hibernate">ScrollMode</A> scrollMode)</CODE>
<BR>
Return the query results as <tt>ScrollableResults</tt>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../org/hibernate/Query.html" title="interface in org.hibernate">Query</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../org/hibernate/Query.html#setBigDecimal(int, java.math.BigDecimal)">setBigDecimal</A></B>(int position, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/math/BigDecimal.html" title="class or interface in java.math">BigDecimal</A> number)</CODE>
<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -