⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 query_hql.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 5 页
字号:
"    and store.location.name in ( 'Melbourne', 'Sydney' )\n""    and prod = all elements(cust.currentOrder.lineItems)]]>"msgstr ""#. Tag: para#: query_hql.xml:761#, no-c-formatmsgid "<emphasis>Hint:</emphasis> something like"msgstr "<emphasis>Un indice :</emphasis> cela donnerait quelque chose comme"#. Tag: programlisting#: query_hql.xml:765#, no-c-formatmsgid """<![CDATA[SELECT cust.name, cust.address, cust.phone, cust.id, cust.""current_order\n""FROM customers cust,\n""    stores store,\n""    locations loc,\n""    store_customers sc,\n""    product prod\n""WHERE prod.name = 'widget'\n""    AND store.loc_id = loc.id\n""    AND loc.name IN ( 'Melbourne', 'Sydney' )\n""    AND sc.store_id = store.id\n""    AND sc.cust_id = cust.id\n""    AND prod.id = ALL(\n""        SELECT item.prod_id\n""        FROM line_items item, orders o\n""        WHERE item.order_id = o.id\n""            AND cust.current_order = o.id\n""    )]]>"msgstr ""#. Tag: title#: query_hql.xml:770#, no-c-formatmsgid "The order by clause"msgstr "La clause order by"#. Tag: para#: query_hql.xml:772#, no-c-formatmsgid """The list returned by a query may be ordered by any property of a returned ""class or components:"msgstr """La liste retounée par la requête peut être triée par n'importe quelle ""propriété de la classe ou du composant retourné :"#. Tag: programlisting#: query_hql.xml:776#, no-c-formatmsgid """<![CDATA[from DomesticCat cat\n""order by cat.name asc, cat.weight desc, cat.birthdate]]>"msgstr ""#. Tag: para#: query_hql.xml:778#, no-c-formatmsgid """The optional <literal>asc</literal> or <literal>desc</literal> indicate ""ascending or descending order respectively."msgstr """Le mot optionnel <literal>asc</literal> ou <literal>desc</literal> indique ""respectivement si le tri doit être croissant ou décroissant."#. Tag: title#: query_hql.xml:785#, no-c-formatmsgid "The group by clause"msgstr "La clause group by"#. Tag: para#: query_hql.xml:787#, no-c-formatmsgid """A query that returns aggregate values may be grouped by any property of a ""returned class or components:"msgstr """Si la requête retourne des valeurs aggrégées, celles ci peuvent être ""groupées par propriété ou composant :"#. Tag: programlisting#: query_hql.xml:791#, no-c-formatmsgid """<![CDATA[select cat.color, sum(cat.weight), count(cat)\n""from Cat cat\n""group by cat.color]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:793#, no-c-formatmsgid """<![CDATA[select foo.id, avg(name), max(name)\n""from Foo foo join foo.names name\n""group by foo.id]]>"msgstr ""#. Tag: para#: query_hql.xml:795#, no-c-formatmsgid "A <literal>having</literal> clause is also allowed."msgstr "Une clause <literal>having</literal> est aussi permise."#. Tag: programlisting#: query_hql.xml:799#, no-c-formatmsgid """<![CDATA[select cat.color, sum(cat.weight), count(cat)\n""from Cat cat\n""group by cat.color\n""having cat.color in (eg.Color.TABBY, eg.Color.BLACK)]]>"msgstr ""#. Tag: para#: query_hql.xml:801#, no-c-formatmsgid """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 """Les fonctions SQL et les fonctions d'aggrégations sont permises dans les ""clauses <literal>having</literal> et <literal>order by</literal>, si elles ""sont supportées par la base de données (ce que ne fait pas MySQL par ""exemple)."#. Tag: programlisting#: query_hql.xml:807#, no-c-formatmsgid """<![CDATA[select cat\n""from Cat cat\n""    join cat.kittens kitten\n""group by cat.id, cat.name, cat.other, cat.properties\n""having avg(kitten.weight) > 100\n""order by count(kitten) asc, sum(kitten.weight) desc]]>"msgstr ""#. Tag: para#: query_hql.xml:809#, no-c-formatmsgid """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 """Notez que ni la clause <literal>group by</literal> ni la clause ""<literal>order by</literal> ne peuvent contenir d'expressions arithmétiques."#. Tag: title#: query_hql.xml:821#, no-c-formatmsgid "Subqueries"msgstr "Sous-requêtes"#. Tag: para#: query_hql.xml:823#, no-c-formatmsgid """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 """Pour les bases de données le supportant, Hibernate supporte les sous ""requêtes dans les requêtes. Une sous requête doit être entre parenthèses ""(souvent pour un appel à une fonction d'agrégation SQL) Même les sous ""requêtes corrélées (celles qui font référence à un alias de la requête ""principale) sont supportées."#. Tag: programlisting#: query_hql.xml:829#, no-c-formatmsgid """<![CDATA[from Cat as fatcat\n""where fatcat.weight > (\n""    select avg(cat.weight) from DomesticCat cat\n"")]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:831#, no-c-formatmsgid """<![CDATA[from DomesticCat as cat\n""where cat.name = some (\n""    select name.nickName from Name as name\n"")]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:833#, no-c-formatmsgid """<![CDATA[from Cat as cat\n""where not exists (\n""    from Cat as mate where mate.mate = cat\n"")]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:835#, no-c-formatmsgid """<![CDATA[from DomesticCat as cat\n""where cat.name not in (\n""    select name.nickName from Name as name\n"")]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:837#, no-c-formatmsgid """<![CDATA[select cat.id, (select max(kit.weight) from cat.kitten kit)\n""from Cat as cat]]>"msgstr ""#. Tag: para#: query_hql.xml:839#, no-c-formatmsgid "Note that HQL subqueries may occur only in the select or where clauses."msgstr """Notez que les sous-requêtes HQL peuvent arriver seulememnt dans les clauses ""select ou where."#. Tag: para#: query_hql.xml:843#, no-c-formatmsgid """Note that subqueries can also utilize <literal>row value constructor</""literal> syntax. See <xref linkend=\"queryhql-tuple\"/> for more details."msgstr """Note that subqueries can also utilize <literal>row value constructor</""literal> syntax. See <xref linkend=\"queryhql-tuple\"/> for more details."#. Tag: title#: query_hql.xml:851#, no-c-formatmsgid "HQL examples"msgstr "Exemples HQL"#. Tag: para#: query_hql.xml:853#, no-c-formatmsgid """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 """Les requêtes Hibernate peuvent être relativement puissantes et complexes. En ""fait, la puissance du langage de requêtage est l'un des avantages principaux ""d'Hibernate. Voici quelques exemples très similaires aux requêtes que nous ""avons utilisées lors d'un récent projet. Notez que la plupart des requêtes ""que vous écrirez seront plus simples que les exemples suivantes !"#. Tag: para#: query_hql.xml:859#, no-c-formatmsgid """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 """La requête suivante retourne l'id de commande (order), le nombre d'articles ""(items) et la valeur totale de la commande (order) pour toutes les commandes ""non payées d'un client (customer) particulier pour un total minimum donné, ""le tout trié par la valeur totale. La requête SQL générée sur les tables ""<literal>ORDER</literal>, <literal>ORDER_LINE</literal>, <literal>PRODUCT</""literal>, <literal>CATALOG</literal> et <literal>PRICE</literal> est ""composée de quatre jointures interne ainsi que d'une sous-requête (non ""corrélée)."#. Tag: programlisting#: query_hql.xml:868#, no-c-formatmsgid """<![CDATA[select order.id, sum(price.amount), count(item)\n""from Order as order\n""    join order.lineItems as item\n""    join item.product as product,\n""    Catalog as catalog\n""    join catalog.prices as price\n""where order.paid = false\n""    and order.customer = :customer\n""    and price.product = product\n""    and catalog.effectiveDate < sysdate\n""    and catalog.effectiveDate >= all (\n""        select cat.effectiveDate\n""        from Catalog as cat\n""        where cat.effectiveDate < sysdate\n""    )\n""group by order\n""having sum(price.amount) > :minAmount\n""order by sum(price.amount) desc]]>"msgstr ""#. Tag: para#: query_hql.xml:870#, no-c-formatmsgid """What a monster! Actually, in real life, I'm not very keen on subqueries, so ""my query was really more like this:"msgstr """Quel monstre ! En principe, nous ne sommes pas très fan des sous-requêtes, ""la requête ressemblait donc plutôt à cela :"#. Tag: programlisting#: query_hql.xml:875#, no-c-formatmsgid """<![CDATA[select order.id, sum(price.amount), count(item)\n""from Order as order\n""    join order.lineItems as item\n""    join item.product as product,\n""    Catalog as catalog\n""    join catalog.prices as price\n""where order.paid = false\n""    and order.customer = :customer\n""    and price.product = product\n""    and catalog = :currentCatalog\n""group by order\n""having sum(price.amount) > :minAmount\n""order by sum(price.amount) desc]]>"msgstr ""#. Tag: para#: query_hql.xml:877#, no-c-formatmsgid """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 """La requête suivante compte le nombre de paiements (payments) pour chaque ""status, en excluant les paiements dans le status <literal>AWAITING_APPROVAL</""literal> où le changement de status le plus récent à été fait par ""l'utilisateur courant. En SQL, cette requête effectue deux jointures ""internes et des sous requêtes corrélées sur les tables <literal>PAYMENT</""literal>, <literal>PAYMENT_STATUS</literal> et ""<literal>PAYMENT_STATUS_CHANGE</literal>."#. Tag: programlisting#: query_hql.xml:885#, no-c-formatmsgid """<![CDATA[select count(payment), status.name\n""from Payment as payment\n""    join payment.currentStatus as status\n""    join payment.statusChanges as statusChange\n""where payment.status.name <> PaymentStatus.AWAITING_APPROVAL\n""    or (\n""        statusChange.timeStamp = (\n""            select max(change.timeStamp)\n""            from PaymentStatusChange change\n""            where change.payment = payment\n""        )\n""        and statusChange.user <> :currentUser\n""    )\n""group by status.name, status.sortOrder\n""order by status.sortOrder]]>"msgstr ""#. Tag: para#: query_hql.xml:887#, no-c-formatmsgid """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 """Si nous avions mappé la collection <literal>statusChanges</literal> comme ""une liste, au lieu d'un ensemble, la requête aurait été plus facile à écrire."#. Tag: programlisting#: query_hql.xml:892#, no-c-formatmsgid """<![CDATA[select count(payment), status.name\n""from Payment as payment\n""    join payment.currentStatus as status\n""where payment.status.name <> PaymentStatus.AWAITING_APPROVAL\n""    or payment.statusChanges[ maxIndex(payment.statusChanges) ].user <> :""currentUser\n""group by status.name, status.sortOrder\n""order by status.sortOrder]]>"msgstr ""#. Tag: para#: query_hql.xml:894#, no-c-formatmsgid """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>, "

⌨️ 快捷键说明

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