📄 query_hql.pot
字号:
#: query_hql.xml:554(para) msgid "Expressions allowed in the <literal>where</literal> clause include most of the kind of things you could write in SQL:"msgstr ""#: query_hql.xml:561(para) msgid "mathematical operators <literal>+, -, *, /</literal>"msgstr ""#: query_hql.xml:566(para) msgid "binary comparison operators <literal>=, >=, <=, <>, !=, like</literal>"msgstr ""#: query_hql.xml:571(para) msgid "logical operations <literal>and, or, not</literal>"msgstr ""#: query_hql.xml:576(para) msgid "Parentheses <literal>( )</literal>, indicating grouping"msgstr ""#: query_hql.xml:581(para) msgid "<literal>in</literal>, <literal>not in</literal>, <literal>between</literal>, <literal>is null</literal>, <literal>is not null</literal>, <literal>is empty</literal>, <literal>is not empty</literal>, <literal>member of</literal> and <literal>not member of</literal>"msgstr ""#: query_hql.xml:594(para) msgid "\"Simple\" case, <literal>case ... when ... then ... else ... end</literal>, and \"searched\" case, <literal>case when ... then ... else ... end</literal>"msgstr ""#: query_hql.xml:600(para) msgid "string concatenation <literal>...||...</literal> or <literal>concat(...,...)</literal>"msgstr ""#: query_hql.xml:605(para) msgid "<literal>current_date()</literal>, <literal>current_time()</literal>, <literal>current_timestamp()</literal>"msgstr ""#: query_hql.xml:611(para) msgid "<literal>second(...)</literal>, <literal>minute(...)</literal>, <literal>hour(...)</literal>, <literal>day(...)</literal>, <literal>month(...)</literal>, <literal>year(...)</literal>,"msgstr ""#: query_hql.xml:618(para) msgid "Any function or operator defined by EJB-QL 3.0: <literal>substring(), trim(), lower(), upper(), length(), locate(), abs(), sqrt(), bit_length(), mod()</literal>"msgstr ""#: query_hql.xml:624(para) msgid "<literal>coalesce()</literal> and <literal>nullif()</literal>"msgstr ""#: query_hql.xml:629(para) msgid "<literal>str()</literal> for converting numeric or temporal values to a readable string"msgstr ""#: query_hql.xml:635(para) msgid "<literal>cast(... as ...)</literal>, where the second argument is the name of a Hibernate type, and <literal>extract(... from ...)</literal> if ANSI <literal>cast()</literal> and <literal>extract()</literal> is supported by the underlying database"msgstr ""#: query_hql.xml:643(para) msgid "the HQL <literal>index()</literal> function, that applies to aliases of a joined indexed collection"msgstr ""#: query_hql.xml:649(para) msgid "HQL functions that take collection-valued path expressions: <literal>size(), minelement(), maxelement(), minindex(), maxindex()</literal>, along with the special <literal>elements()</literal> and <literal>indices</literal> functions which may be quantified using <literal>some, all, exists, any, in</literal>."msgstr ""#: query_hql.xml:657(para) msgid "Any database-supported SQL scalar function like <literal>sign()</literal>, <literal>trunc()</literal>, <literal>rtrim()</literal>, <literal>sin()</literal>"msgstr ""#: query_hql.xml:663(para) msgid "JDBC-style positional parameters <literal>?</literal>"msgstr ""#: query_hql.xml:668(para) msgid "named parameters <literal>:name</literal>, <literal>:start_date</literal>, <literal>:x1</literal>"msgstr ""#: query_hql.xml:673(para) msgid "SQL literals <literal>'foo'</literal>, <literal>69</literal>, <literal>6.66E+2</literal>, <literal>'1970-01-01 10:00:01.0'</literal>"msgstr ""#: query_hql.xml:679(para) msgid "Java <literal>public static final</literal> constants <literal>eg.Color.TABBY</literal>"msgstr ""#: query_hql.xml:685(para) msgid "<literal>in</literal> and <literal>between</literal> may be used as follows:"msgstr ""#: query_hql.xml:693(para) msgid "and the negated forms may be written"msgstr ""#: query_hql.xml:701(para) msgid "Likewise, <literal>is null</literal> and <literal>is not null</literal> may be used to test for null values."msgstr ""#: query_hql.xml:706(para) msgid "Booleans may be easily used in expressions by declaring HQL query substitutions in Hibernate configuration:"msgstr ""#: query_hql.xml:713(para) msgid "This will replace the keywords <literal>true</literal> and <literal>false</literal> with the literals <literal>1</literal> and <literal>0</literal> in the translated SQL from this HQL:"msgstr ""#: query_hql.xml:720(para) msgid "You may test the size of a collection with the special property <literal>size</literal>, or the special <literal>size()</literal> function."msgstr ""#: query_hql.xml:729(para) msgid "For indexed collections, you may refer to the minimum and maximum indices using <literal>minindex</literal> and <literal>maxindex</literal> functions. Similarly, you may refer to the minimum and maximum elements of a collection of basic type using the <literal>minelement</literal> and <literal>maxelement</literal> functions."msgstr ""#: query_hql.xml:743(para) msgid "The SQL functions <literal>any, some, all, exists, in</literal> are supported when passed the element or index set of a collection (<literal>elements</literal> and <literal>indices</literal> functions) or the result of a subquery (see below)."msgstr ""#: query_hql.xml:761(para) msgid "Note that these constructs - <literal>size</literal>, <literal>elements</literal>, <literal>indices</literal>, <literal>minindex</literal>, <literal>maxindex</literal>, <literal>minelement</literal>, <literal>maxelement</literal> - may only be used in the where clause in Hibernate3."msgstr ""#: query_hql.xml:768(para) msgid "Elements of indexed collections (arrays, lists, maps) may be referred to by index (in a where clause only):"msgstr ""#: query_hql.xml:785(para) msgid "The expression inside <literal>[]</literal> may even be an arithmetic expression."msgstr ""#: query_hql.xml:792(para) msgid "HQL also provides the built-in <literal>index()</literal> function, for elements of a one-to-many association or collection of values."msgstr ""#: query_hql.xml:801(para) msgid "Scalar SQL functions supported by the underlying database may be used"msgstr ""#: query_hql.xml:807(para) msgid "If you are not yet convinced by all this, think how much longer and less readable the following query would be in SQL:"msgstr ""#: query_hql.xml:820(para) msgid "<emphasis>Hint:</emphasis> something like"msgstr ""#: query_hql.xml:845(title) msgid "The order by clause"msgstr ""#: query_hql.xml:847(para) msgid "The list returned by a query may be ordered by any property of a returned class or components:"msgstr ""#: query_hql.xml:854(para) msgid "The optional <literal>asc</literal> or <literal>desc</literal> indicate ascending or descending order respectively."msgstr ""#: query_hql.xml:861(title) msgid "The group by clause"msgstr ""#: query_hql.xml:863(para) msgid "A query that returns aggregate values may be grouped by any property of a returned class or components:"msgstr ""#: query_hql.xml:875(para) msgid "A <literal>having</literal> clause is also allowed."msgstr ""#: query_hql.xml:884(para) msgid "SQL functions and aggregate functions are allowed in the <literal>having</literal> and <literal>order by</literal> clauses, if supported by the underlying database (eg. not in MySQL)."msgstr ""#: query_hql.xml:897(para) msgid "Note that neither the <literal>group by</literal> clause nor the <literal>order by</literal> clause may contain arithmetic expressions. Also note that Hibernate currently does not expand a grouped entity, so you can't write <literal>group by cat</literal> if all properties of <literal>cat</literal> are non-aggregated. You have to list all non-aggregated properties explicitly."msgstr ""#: query_hql.xml:909(title) msgid "Subqueries"msgstr ""#: query_hql.xml:911(para) msgid "For databases that support subselects, Hibernate supports subqueries within queries. A subquery must be surrounded by parentheses (often by an SQL aggregate function call). Even correlated subqueries (subqueries that refer to an alias in the outer query) are allowed."msgstr ""#: query_hql.xml:940(para) msgid "Note that HQL subqueries may occur only in the select or where clauses."msgstr ""#: query_hql.xml:944(para) msgid "Note that subqueries can also utilize <literal>row value constructor</literal> syntax. See <xref linkend=\"queryhql-tuple\"/> for more details."msgstr ""#: query_hql.xml:952(title) msgid "HQL examples"msgstr ""#: query_hql.xml:954(para) msgid "Hibernate queries can be quite powerful and complex. In fact, the power of the query language is one of Hibernate's main selling points. Here are some example queries very similar to queries that I used on a recent project. Note that most queries you will write are much simpler than these!"msgstr ""#: query_hql.xml:960(para) msgid "The following query returns the order id, number of items and total value of the order for all unpaid orders for a particular customer and given minimum total value, ordering the results by total value. In determining the prices, it uses the current catalog. The resulting SQL query, against the <literal>ORDER</literal>, <literal>ORDER_LINE</literal>, <literal>PRODUCT</literal>, <literal>CATALOG</literal> and <literal>PRICE</literal> tables has four inner joins and an (uncorrelated) subselect."msgstr ""#: query_hql.xml:988(para) msgid "What a monster! Actually, in real life, I'm not very keen on subqueries, so my query was really more like this:"msgstr ""#: query_hql.xml:1007(para) msgid "The next query counts the number of payments in each status, excluding all payments in the <literal>AWAITING_APPROVAL</literal> status where the most recent status change was made by the current user. It translates to an SQL query with two inner joins and a correlated subselect against the <literal>PAYMENT</literal>, <literal>PAYMENT_STATUS</literal> and <literal>PAYMENT_STATUS_CHANGE</literal> tables."msgstr ""#: query_hql.xml:1031(para) msgid "If I would have mapped the <literal>statusChanges</literal> collection as a list, instead of a set, the query would have been much simpler to write."msgstr ""#: query_hql.xml:1044(para) msgid "The next query uses the MS SQL Server <literal>isNull()</literal> function to return all the accounts and unpaid payments for the organization to which the current user belongs. It translates to an SQL query with three inner joins, an outer join and a subselect against the <literal>ACCOUNT</literal>, <literal>PAYMENT</literal>, <literal>PAYMENT_STATUS</literal>, <literal>ACCOUNT_TYPE</literal>, <literal>ORGANIZATION</literal> and <literal>ORG_USER</literal> tables."msgstr ""#: query_hql.xml:1060(para) msgid "For some databases, we would need to do away with the (correlated) subselect."msgstr ""#: query_hql.xml:1075(title) msgid "Bulk update and delete"msgstr ""#: query_hql.xml:1077(para) msgid "HQL now supports <literal>update</literal>, <literal>delete</literal> and <literal>insert ... select ...</literal> statements. See <xref linkend=\"batch-direct\"/> for details."msgstr ""#: query_hql.xml:1085(title) msgid "Tips & Tricks"msgstr ""#: query_hql.xml:1087(para) msgid "You can count the number of query results without actually returning them:"msgstr ""#: query_hql.xml:1093(para) msgid "To order a result by the size of a collection, use the following query:"msgstr ""#: query_hql.xml:1103(para) msgid "If your database supports subselects, you can place a condition upon selection size in the where clause of your query:"msgstr ""#: query_hql.xml:1110(para) msgid "If your database doesn't support subselects, use the following query:"msgstr ""#: query_hql.xml:1120(para) msgid "As this solution can't return a <literal>User</literal> with zero messages because of the inner join, the following form is also useful:"msgstr ""#: query_hql.xml:1131(para) msgid "Properties of a JavaBean can be bound to named query parameters:"msgstr ""#: query_hql.xml:1139(para) msgid "Collections are pageable by using the <literal>Query</literal> interface with a filter:"msgstr ""#: query_hql.xml:1148(para) msgid "Collection elements may be ordered or grouped using a query filter:"msgstr ""#: query_hql.xml:1155(para) msgid "You can find the size of a collection without initializing it:"msgstr ""#: query_hql.xml:1164(title) msgid "Components"msgstr ""#: query_hql.xml:1166(para) msgid "Components might be used in just about every way that simple value types can be used in HQL queries. They can appear in the <literal>select</literal> clause:"msgstr ""#: query_hql.xml:1174(para) msgid "where the Person's name property is a component. Components can also be used in the <literal>where</literal> clause:"msgstr ""#: query_hql.xml:1182(para) msgid "Components can also be used in the <literal>order by</literal> clause:"msgstr ""#: query_hql.xml:1189(para) msgid "Another common use of components is in <xref linkend=\"queryhql-tuple\">row value constructors</xref>."msgstr ""#: query_hql.xml:1195(title) msgid "Row value constructor syntax"msgstr ""#: query_hql.xml:1197(para) msgid "HQL supports the use of ANSI SQL <literal>row value constructor</literal> syntax (sometimes called <literal>tuple</literal> syntax), even though the underlying database may not support that notion. Here we are generally referring to multi-valued comparisons, typically associated with components. Consider an entity Person which defines a name component:"msgstr ""#: query_hql.xml:1206(para) msgid "That's valid syntax, although a little verbose. It be nice to make this a bit more concise and use <literal>row value constructor</literal> syntax:"msgstr ""#: query_hql.xml:1213(para) msgid "It can also be useful to specify this in the <literal>select</literal> clause:"msgstr ""#: query_hql.xml:1219(para) msgid "Another time using <literal>row value constructor</literal> syntax can be beneficial is when using subqueries needing to compare against multiple values:"msgstr ""#: query_hql.xml:1229(para) msgid "One thing to consider when deciding if you want to use this syntax is that the query will be dependent upon the ordering of the component sub-properties in the metadata."msgstr ""#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.#: query_hql.xml:0(None) msgid "translator-credits"msgstr ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -