📄 session_api.po
字号:
#. Tag: para#: session_api.xml:309#, no-c-formatmsgid """named parameters are insensitive to the order they occur in the query string"msgstr """named parameters are insensitive to the order they occur in the query string"#. Tag: para#: session_api.xml:315#, no-c-formatmsgid "they may occur multiple times in the same query"msgstr "they may occur multiple times in the same query"#. Tag: para#: session_api.xml:320#, no-c-formatmsgid "they are self-documenting"msgstr "they are self-documenting"#. Tag: programlisting#: session_api.xml:326#, no-c-formatmsgid """<![CDATA[//named parameter (preferred)\n""Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name""\");\n""q.setString(\"name\", \"Fritz\");\n""Iterator cats = q.iterate();]]>"msgstr ""#. Tag: programlisting#: session_api.xml:328#, no-c-formatmsgid """<![CDATA[//positional parameter\n""Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n""q.setString(0, \"Izi\");\n""Iterator cats = q.iterate();]]>"msgstr ""#. Tag: programlisting#: session_api.xml:330#, no-c-formatmsgid """<![CDATA[//named parameter list\n""List names = new ArrayList();\n""names.add(\"Izi\");\n""names.add(\"Fritz\");\n""Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:""namesList)\");\n""q.setParameterList(\"namesList\", names);\n""List cats = q.list();]]>"msgstr ""#. Tag: title#: session_api.xml:335#, no-c-formatmsgid "Pagination"msgstr "Pagination"#. Tag: para#: session_api.xml:337#, no-c-formatmsgid """If you need to specify bounds upon your result set (the maximum number of ""rows you want to retrieve and / or the first row you want to retrieve) you ""should use methods of the <literal>Query</literal> interface:"msgstr """If you need to specify bounds upon your result set (the maximum number of ""rows you want to retrieve and / or the first row you want to retrieve) you ""should use methods of the <literal>Query</literal> interface:"#. Tag: programlisting#: session_api.xml:343#, no-c-formatmsgid """<![CDATA[Query q = sess.createQuery(\"from DomesticCat cat\");\n""q.setFirstResult(20);\n""q.setMaxResults(10);\n""List cats = q.list();]]>"msgstr ""#. Tag: para#: session_api.xml:345#, no-c-formatmsgid """Hibernate knows how to translate this limit query into the native SQL of ""your DBMS."msgstr """Hibernate knows how to translate this limit query into the native SQL of ""your DBMS."#. Tag: title#: session_api.xml:353#, no-c-formatmsgid "Scrollable iteration"msgstr "Scrollable iteration"#. Tag: para#: session_api.xml:355#, no-c-formatmsgid """If your JDBC driver supports scrollable <literal>ResultSet</literal>s, the ""<literal>Query</literal> interface may be used to obtain a ""<literal>ScrollableResults</literal> object, which allows flexible ""navigation of the query results."msgstr """If your JDBC driver supports scrollable <literal>ResultSet</literal>s, the ""<literal>Query</literal> interface may be used to obtain a ""<literal>ScrollableResults</literal> object, which allows flexible ""navigation of the query results."#. Tag: programlisting#: session_api.xml:362#, no-c-formatmsgid """<![CDATA[Query q = sess.createQuery(\"select cat.name, cat from DomesticCat ""cat \" +\n"" \"order by cat.name\");\n""ScrollableResults cats = q.scroll();\n""if ( cats.first() ) {\n""\n"" // find the first name on each page of an alphabetical list of cats by ""name\n"" firstNamesOfPages = new ArrayList();\n"" do {\n"" String name = cats.getString(0);\n"" firstNamesOfPages.add(name);\n"" }\n"" while ( cats.scroll(PAGE_SIZE) );\n""\n"" // Now get the first page of cats\n"" pageOfCats = new ArrayList();\n"" cats.beforeFirst();\n"" int i=0;\n"" while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add( cats.get""(1) );\n""\n""}\n""cats.close()]]>"msgstr ""#. Tag: para#: session_api.xml:364#, no-c-formatmsgid """Note that an open database connection (and cursor) is required for this ""functionality, use <literal>setMaxResult()</literal>/<literal>setFirstResult""()</literal> if you need offline pagination functionality."msgstr """Note that an open database connection (and cursor) is required for this ""functionality, use <literal>setMaxResult()</literal>/<literal>setFirstResult""()</literal> if you need offline pagination functionality."#. Tag: title#: session_api.xml:373#, no-c-formatmsgid "Externalizing named queries"msgstr "Externalizing named queries"#. Tag: para#: session_api.xml:375#, no-c-formatmsgid """You may also define named queries in the mapping document. (Remember to use ""a <literal>CDATA</literal> section if your query contains characters that ""could be interpreted as markup.)"msgstr """You may also define named queries in the mapping document. (Remember to use ""a <literal>CDATA</literal> section if your query contains characters that ""could be interpreted as markup.)"#. Tag: programlisting#: session_api.xml:381#, no-c-formatmsgid """<![CDATA[<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n"" from eg.DomesticCat as cat\n"" where cat.name = ?\n"" and cat.weight > ?\n""] ]></query>]]>"msgstr ""#. Tag: para#: session_api.xml:383#, no-c-formatmsgid "Parameter binding and executing is done programatically:"msgstr "Parameter binding and executing is done programatically:"#. Tag: programlisting#: session_api.xml:387#, no-c-formatmsgid """<![CDATA[Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n""q.setString(0, name);\n""q.setInt(1, minWeight);\n""List cats = q.list();]]>"msgstr ""#. Tag: para#: session_api.xml:389#, no-c-formatmsgid """Note that the actual program code is independent of the query language that ""is used, you may also define native SQL queries in metadata, or migrate ""existing queries to Hibernate by placing them in mapping files."msgstr """Note that the actual program code is independent of the query language that ""is used, you may also define native SQL queries in metadata, or migrate ""existing queries to Hibernate by placing them in mapping files."#. Tag: para#: session_api.xml:395#, no-c-formatmsgid """Also note that a query declaration inside a <literal><hibernate-""mapping></literal> element requires a global unique name for the query, ""while a query declaration inside a <literal><class></literal> element ""is made unique automatically by prepending the fully qualified name of the ""class, for example <literal>eg.Cat.ByNameAndMaximumWeight</literal>."msgstr """Also note that a query declaration inside a <literal><hibernate-""mapping></literal> element requires a global unique name for the query, ""while a query declaration inside a <literal><class></literal> element ""is made unique automatically by prepending the fully qualified name of the ""class, for example <literal>eg.Cat.ByNameAndMaximumWeight</literal>."#. Tag: title#: session_api.xml:408#, no-c-formatmsgid "Filtering collections"msgstr "Filtering collections"#. Tag: para#: session_api.xml:409#, no-c-formatmsgid """A collection <emphasis>filter</emphasis> is a special type of query that may ""be applied to a persistent collection or array. The query string may refer ""to <literal>this</literal>, meaning the current collection element."msgstr """A collection <emphasis>filter</emphasis> is a special type of query that may ""be applied to a persistent collection or array. The query string may refer ""to <literal>this</literal>, meaning the current collection element."#. Tag: programlisting#: session_api.xml:415#, no-c-formatmsgid """<![CDATA[Collection blackKittens = session.createFilter(\n"" pk.getKittens(), \n"" \"where this.color = ?\")\n"" .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n"" .list()\n"");]]>"msgstr ""#. Tag: para#: session_api.xml:417#, no-c-formatmsgid """The returned collection is considered a bag, and it's a copy of the given ""collection. The original collection is not modified (this is contrary to the ""implication of the name \"filter\", but consistent with expected behavior)."msgstr """The returned collection is considered a bag, and it's a copy of the given ""collection. The original collection is not modified (this is contrary to the ""implication of the name \"filter\", but consistent with expected behavior)."#. Tag: para#: session_api.xml:423#, no-c-formatmsgid """Observe that filters do not require a <literal>from</literal> clause (though ""they may have one if required). Filters are not limited to returning the ""collection elements themselves."msgstr """Observe that filters do not require a <literal>from</literal> clause (though ""they may have one if required). Filters are not limited to returning the ""collection elements themselves."#. Tag: programlisting#: session_api.xml:428#, no-c-formatmsgid """<![CDATA[Collection blackKittenMates = session.createFilter(\n"" pk.getKittens(), \n"" \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n"" .list();]]>"msgstr ""#. Tag: para#: session_api.xml:430#, no-c-formatmsgid """Even an empty filter query is useful, e.g. to load a subset of elements in a ""huge collection:"msgstr """Even an empty filter query is useful, e.g. to load a subset of elements in a ""huge collection:"#. Tag: programlisting#: session_api.xml:435#, no-c-formatmsgid """<![CDATA[Collection tenKittens = session.createFilter(\n"" mother.getKittens(), \"\")\n"" .setFirstResult(0).setMaxResults(10)\n"" .list();]]>"msgstr ""#. Tag: title#: session_api.xml:440#, no-c-formatmsgid "Criteria queries"msgstr "Criteria queries"#. Tag: para#: session_api.xml:442#, no-c-formatmsgid """HQL is extremely powerful but some developers prefer to build queries ""dynamically, using an object-oriented API, rather than building query ""strings. Hibernate provides an intuitive <literal>Criteria</literal> query ""API for these cases:"msgstr """HQL is extremely powerful but some developers prefer to build queries ""dynamically, using an object-oriented API, rather than building query ""strings. Hibernate provides an intuitive <literal>Criteria</literal> query ""API for these cases:"#. Tag: programlisting#: session_api.xml:448#, no-c-formatmsgid """<![CDATA[Criteria crit = session.createCriteria(Cat.class);\n""crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n""crit.setMaxResults(10);\n""List cats = crit.list();]]>"msgstr ""#. Tag: para#: session_api.xml:450#, no-c-formatmsgid """The <literal>Criteria</literal> and the associated <literal>Example</""literal> API are discussed in more detail in <xref linkend=\"querycriteria\"/"">."msgstr """The <literal>Criteria</literal> and the associated <literal>Example</""literal> API are discussed in more detail in <xref linkend=\"querycriteria\"/"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -