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

📄 query_criteria.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 2 页
字号:
msgstr """Les propriétés de type version, identifiant et association sont ignorées. ""Par défaut, les valeurs null sont exclues."#. Tag: para#: query_criteria.xml:174#, no-c-formatmsgid "You can adjust how the <literal>Example</literal> is applied."msgstr """Vous pouvez ajuster la stratégie d'utilisation de valeurs de ""l'<literal>Exemple</literal>."#. Tag: programlisting#: query_criteria.xml:178#, no-c-formatmsgid """<![CDATA[Example example = Example.create(cat)\n""    .excludeZeroes()           //exclude zero valued properties\n""    .excludeProperty(\"color\")  //exclude the property named \"color\"\n""    .ignoreCase()              //perform case insensitive string ""comparisons\n""    .enableLike();             //use like for string comparisons\n""List results = session.createCriteria(Cat.class)\n""    .add(example)\n""    .list();]]>"msgstr ""#. Tag: para#: query_criteria.xml:180#, no-c-formatmsgid "You can even use examples to place criteria upon associated objects."msgstr """Vous pouvez utiliser les \"exemples\" pour des critères sur les objets ""associés."#. Tag: programlisting#: query_criteria.xml:184#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .add( Example.create(cat) )\n""    .createCriteria(\"mate\")\n""        .add( Example.create( cat.getMate() ) )\n""    .list();]]>"msgstr ""#. Tag: title#: query_criteria.xml:189#, no-c-formatmsgid "Projections, aggregation and grouping"msgstr "Projections, agrégation et regroupement"#. Tag: para#: query_criteria.xml:190#, no-c-formatmsgid """The class <literal>org.hibernate.criterion.Projections</literal> is a ""factory for <literal>Projection</literal> instances. We apply a projection ""to a query by calling <literal>setProjection()</literal>."msgstr """La classe <literal>org.hibernate.criterion.Projections</literal> est une ""fabrique d'instances de <literal>Projection</literal>. Nous appliquons une ""projection sur une requête en appelant <literal>setProjection()</literal>."#. Tag: programlisting#: query_criteria.xml:196#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .setProjection( Projections.rowCount() )\n""    .add( Restrictions.eq(\"color\", Color.BLACK) )\n""    .list();]]>"msgstr ""#. Tag: programlisting#: query_criteria.xml:198#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .setProjection( Projections.projectionList()\n""        .add( Projections.rowCount() )\n""        .add( Projections.avg(\"weight\") )\n""        .add( Projections.max(\"weight\") )\n""        .add( Projections.groupProperty(\"color\") )\n""    )\n""    .list();]]>"msgstr ""#. Tag: para#: query_criteria.xml:200#, no-c-formatmsgid """There is no explicit \"group by\" necessary in a criteria query. Certain ""projection types are defined to be <emphasis>grouping projections</""emphasis>, which also appear in the SQL <literal>group by</literal> clause."msgstr """Il n'y a pas besoin de \"group by\" explicite dans une requête par critère. ""Certains types de projection sont définis pour être des ""<emphasis>projections de regroupement</emphasis>, lesquels apparaissent ""aussi dans la clause <literal>group by</literal> SQL."#. Tag: para#: query_criteria.xml:206#, no-c-formatmsgid """An alias may optionally be assigned to a projection, so that the projected ""value may be referred to in restrictions or orderings. Here are two ""different ways to do this:"msgstr """Un alias peut optionnellement être assigné à une projection, ainsi la valeur ""projetée peut être référencée dans des restrictions ou des tris. Voici deux ""façons différentes de faire ça :"#. Tag: programlisting#: query_criteria.xml:212#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .setProjection( Projections.alias( Projections.groupProperty(\"color\"), ""\"colr\" ) )\n""    .addOrder( Order.asc(\"colr\") )\n""    .list();]]>"msgstr ""#. Tag: programlisting#: query_criteria.xml:214#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .setProjection( Projections.groupProperty(\"color\").as(\"colr\") )\n""    .addOrder( Order.asc(\"colr\") )\n""    .list();]]>"msgstr ""#. Tag: para#: query_criteria.xml:216#, no-c-formatmsgid """The <literal>alias()</literal> and <literal>as()</literal> methods simply ""wrap a projection instance in another, aliased, instance of ""<literal>Projection</literal>. As a shortcut, you can assign an alias when ""you add the projection to a projection list:"msgstr """Les méthodes <literal>alias()</literal> et <literal>as()</literal> enveloppe ""simplement une instance de projection dans une autre instance (aliasée) de ""<literal>Projection</literal>. Comme un raccourci, vous pouvez assignez un ""alias lorsque vous ajoutez la projection à la liste de projections :"#. Tag: programlisting#: query_criteria.xml:223#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .setProjection( Projections.projectionList()\n""        .add( Projections.rowCount(), \"catCountByColor\" )\n""        .add( Projections.avg(\"weight\"), \"avgWeight\" )\n""        .add( Projections.max(\"weight\"), \"maxWeight\" )\n""        .add( Projections.groupProperty(\"color\"), \"color\" )\n""    )\n""    .addOrder( Order.desc(\"catCountByColor\") )\n""    .addOrder( Order.desc(\"avgWeight\") )\n""    .list();]]>"msgstr ""#. Tag: programlisting#: query_criteria.xml:225#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Domestic.class, \"cat\")\n""    .createAlias(\"kittens\", \"kit\")\n""    .setProjection( Projections.projectionList()\n""        .add( Projections.property(\"cat.name\"), \"catName\" )\n""        .add( Projections.property(\"kit.name\"), \"kitName\" )\n""    )\n""    .addOrder( Order.asc(\"catName\") )\n""    .addOrder( Order.asc(\"kitName\") )\n""    .list();]]>"msgstr ""#. Tag: para#: query_criteria.xml:227#, no-c-formatmsgid """You can also use <literal>Property.forName()</literal> to express ""projections:"msgstr """Vous pouvez aussi utiliser <literal>Property.forName()</literal> pour ""formuler des projections :"#. Tag: programlisting#: query_criteria.xml:231#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .setProjection( Property.forName(\"name\") )\n""    .add( Property.forName(\"color\").eq(Color.BLACK) )\n""    .list();]]>"msgstr ""#. Tag: programlisting#: query_criteria.xml:233#, no-c-formatmsgid """<![CDATA[List results = session.createCriteria(Cat.class)\n""    .setProjection( Projections.projectionList()\n""        .add( Projections.rowCount().as(\"catCountByColor\") )\n""        .add( Property.forName(\"weight\").avg().as(\"avgWeight\") )\n""        .add( Property.forName(\"weight\").max().as(\"maxWeight\") )\n""        .add( Property.forName(\"color\").group().as(\"color\" )\n""    )\n""    .addOrder( Order.desc(\"catCountByColor\") )\n""    .addOrder( Order.desc(\"avgWeight\") )\n""    .list();]]>"msgstr ""#. Tag: title#: query_criteria.xml:238#, no-c-formatmsgid "Detached queries and subqueries"msgstr "Requêtes et sous-requêtes détachées"#. Tag: para#: query_criteria.xml:239#, no-c-formatmsgid """The <literal>DetachedCriteria</literal> class lets you create a query ""outside the scope of a session, and then later execute it using some ""arbitrary <literal>Session</literal>."msgstr """La classe <literal>DetachedCriteria</literal> vous laisse créer une requête ""en dehors de la portée de la session, et puis l'exécuter plus tard en ""utilisant n'importe quelle <literal>Session</literal> arbitraire."#. Tag: programlisting#: query_criteria.xml:244#, no-c-formatmsgid """<![CDATA[DetachedCriteria query = DetachedCriteria.forClass(Cat.class)\n""    .add( Property.forName(\"sex\").eq('F') );\n""    \n""Session session = ....;\n""Transaction txn = session.beginTransaction();\n""List results = query.getExecutableCriteria(session).setMaxResults(100).list""();\n""txn.commit();\n""session.close();]]>"msgstr ""#. Tag: para#: query_criteria.xml:246#, no-c-formatmsgid """A <literal>DetachedCriteria</literal> may also be used to express a ""subquery. Criterion instances involving subqueries may be obtained via ""<literal>Subqueries</literal> or <literal>Property</literal>."msgstr """Une <literal>DetachedCriteria</literal> peut aussi être utilisée pour ""exprimer une sous-requête. Des instances de criterion impliquant des sous-""requêtes peuvent être obtenues via <literal>Subqueries</literal> ou ""<literal>Property</literal>."#. Tag: programlisting#: query_criteria.xml:252#, no-c-formatmsgid """<![CDATA[DetachedCriteria avgWeight = DetachedCriteria.forClass(Cat.class)\n""    .setProjection( Property.forName(\"weight\").avg() );\n""session.createCriteria(Cat.class)\n""    .add( Property.forName(\"weight\").gt(avgWeight) )\n""    .list();]]>"msgstr ""#. Tag: programlisting#: query_criteria.xml:254#, no-c-formatmsgid """<![CDATA[DetachedCriteria weights = DetachedCriteria.forClass(Cat.class)\n""    .setProjection( Property.forName(\"weight\") );\n""session.createCriteria(Cat.class)\n""    .add( Subqueries.geAll(\"weight\", weights) )\n""    .list();]]>"msgstr ""#. Tag: para#: query_criteria.xml:256#, no-c-formatmsgid "Even correlated subqueries are possible:"msgstr "Même des requêtes corrélées sont possibles :"#. Tag: programlisting#: query_criteria.xml:260#, no-c-formatmsgid """<![CDATA[DetachedCriteria avgWeightForSex = DetachedCriteria.forClass(Cat.""class, \"cat2\")\n""    .setProjection( Property.forName(\"weight\").avg() )\n""    .add( Property.forName(\"cat2.sex\").eqProperty(\"cat.sex\") );\n""session.createCriteria(Cat.class, \"cat\")\n""    .add( Property.forName(\"weight\").gt(avgWeightForSex) )\n""    .list();]]>"msgstr ""#. Tag: title#: query_criteria.xml:269#, no-c-formatmsgid "Queries by natural identifier"msgstr "Requêtes par identifiant naturel"#. Tag: para#: query_criteria.xml:271#, no-c-formatmsgid """For most queries, including criteria queries, the query cache is not very ""efficient, because query cache invalidation occurs too frequently. However, ""there is one special kind of query where we can optimize the cache ""invalidation algorithm: lookups by a constant natural key. In some ""applications, this kind of query occurs frequently. The criteria API ""provides special provision for this use case."msgstr """Pour la plupart des requêtes, incluant les requêtes par critère, le cache de ""requêtes n'est pas très efficace, parce que l'invalidation du cache de ""requêtes arrive trop souvent. Cependant, il y a une sorte spéciale de ""requête où nous pouvons optimiser l'algorithme d'invalidation du cache : les ""recherches sur une clef naturelle constante. Dans certaines applications, ""cette sorte de requête se produit fréquemment. L'API de critère fournit une ""provision spéciale pour ce cas d'utilisation."#. Tag: para#: query_criteria.xml:279#, no-c-formatmsgid """First, you should map the natural key of your entity using <literal>&lt;""natural-id&gt;</literal>, and enable use of the second-level cache."msgstr """D'abord vous devriez mapper la clef naturelle de votre entité en utilisant ""<literal>&lt;natural-id&gt;</literal>, et activer l'utilisation du cache de ""second niveau."#. Tag: programlisting#: query_criteria.xml:284#, no-c-formatmsgid """<![CDATA[<class name=\"User\">\n""    <cache usage=\"read-write\"/>\n""    <id name=\"id\">\n""        <generator class=\"increment\"/>\n""    </id>\n""    <natural-id>\n""        <property name=\"name\"/>\n""        <property name=\"org\"/>\n""    </natural-id>\n""    <property name=\"password\"/>\n""</class>]]>"msgstr ""#. Tag: para#: query_criteria.xml:286#, no-c-formatmsgid """Note that this functionality is not intended for use with entities with ""<emphasis>mutable</emphasis> natural keys."msgstr """Notez que cette fonctionnalité n'est pas prévue pour l'utilisation avec des ""entités avec des clefs naturelles <emphasis>mutables</emphasis>."#. Tag: para#: query_criteria.xml:291#, no-c-formatmsgid "Next, enable the Hibernate query cache."msgstr "Ensuite, activez le cache de requête d'Hibernate."#. Tag: para#: query_criteria.xml:295#, no-c-formatmsgid """Now, <literal>Restrictions.naturalId()</literal> allows us to make use of ""the more efficient cache algorithm."msgstr """Maintenant <literal>Restrictions.naturalId()</literal> nous permet de rendre ""l'utilisation de l'algorithme de cache plus efficace."#. Tag: programlisting#: query_criteria.xml:300#, no-c-formatmsgid """<![CDATA[session.createCriteria(User.class)\n""    .add( Restrictions.naturalId()\n""        .set(\"name\", \"gavin\")\n""        .set(\"org\", \"hb\") \n""    ).setCacheable(true)\n""    .uniqueResult();]]>"msgstr ""

⌨️ 快捷键说明

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