📄 query_criteria.po
字号:
"Version properties, identifiers and associations are ignored. By default, ""null valued properties are excluded."msgstr """バージョンプロパティ、識別子、関連は無視されます。 デフォルトではnull値のプロ""パティは除外されます。"#. Tag: para#: query_criteria.xml:150#, no-c-formatmsgid "You can adjust how the <literal>Example</literal> is applied."msgstr """どのように <literal>Example</literal> を適用するか 調整することができます。"#. Tag: programlisting#: query_criteria.xml:154#, 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:156#, no-c-formatmsgid "You can even use examples to place criteria upon associated objects."msgstr """関連オブジェクトにcriteriaを指定するために、Exampleを使うことも可能です。"#. Tag: programlisting#: query_criteria.xml:160#, 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:165#, no-c-formatmsgid "Projections, aggregation and grouping"msgstr "射影、集約、グループ化"#. Tag: para#: query_criteria.xml:166#, 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 """<literal>org.hibernate.criterion.Projections</literal> クラスは ""<literal>Projection</literal> インスタンスのファクトリです。 ""<literal>setProjection()</literal> を呼び出すことで、 クエリに射影を適用しま""す。"#. Tag: programlisting#: query_criteria.xml:172#, 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:174#, 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:176#, 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 """必要であっても、criteriaクエリに「group by」を明示する必要はありません。 ある""種のProjection型は <emphasis>グループ化射影</emphasis> として定義され、 SQL""の <literal>group by</literal> 節にも現れます。"#. Tag: para#: query_criteria.xml:182#, 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 """任意で射影に別名を付けられるため、射影される値はrestrictionやordering内から参""照できます。 別名をつける2つの異なる方法を示します。"#. Tag: programlisting#: query_criteria.xml:188#, 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:190#, 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:192#, 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 """<literal>alias()</literal> と <literal>as()</literal> メソッドは、 Projection""インスタンスを別の名前の <literal>Projection</literal> インスタンスで ラップ""するだけです。 ショートカットとして、射影を射影リストに追加する際に、別名をつ""けられます。"#. Tag: programlisting#: query_criteria.xml:199#, 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:201#, 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:203#, no-c-formatmsgid """You can also use <literal>Property.forName()</literal> to express ""projections:"msgstr "射影の式に <literal>Property.forName()</literal> も使用できます。"#. Tag: programlisting#: query_criteria.xml:207#, 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:209#, 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:214#, no-c-formatmsgid "Detached queries and subqueries"msgstr "クエリおよびサブクエリの分離"#. Tag: para#: query_criteria.xml:215#, 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 """<literal>DetachedCriteria</literal> クラスにより、 セッションスコープ外にクエ""リを作成できます。 後で、任意の <literal>Session</literal> を使って、実行でき""ます。"#. Tag: programlisting#: query_criteria.xml:220#, 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:222#, 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 """<literal>DetachedCriteria</literal> は、サブクエリを表現するためにも使えま""す。 サブクエリを伴うCriterionインスタンスは、 <literal>Subqueries</literal> ""もしくは <literal>Property</literal> から得られます。"#. Tag: programlisting#: query_criteria.xml:228#, 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:230#, 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:232#, no-c-formatmsgid "Even correlated subqueries are possible:"msgstr "相互関係があるサブクエリでさえも可能です。"#. Tag: programlisting#: query_criteria.xml:236#, 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:245#, no-c-formatmsgid "Queries by natural identifier"msgstr "自然識別子によるクエリ"#. Tag: para#: query_criteria.xml:247#, 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 """criteriaクエリを含むたいていのクエリにとって、 クエリキャッシュはあまり効率が""よくないです。 なぜなら、クエリキャッシュが頻繁に無効になるためです。 しかし""ながら、キャッシュを無効にするアルゴリズムを最適化できる 特別なクエリの種類が""1つあります。 更新されない自然キーによる検索です。 いくつかのアプリケーショ""ンでは、この種類のクエリが頻繁に現れます。 このような使われ方のために、""criteria APIは特別な対策を提供します。"#. Tag: para#: query_criteria.xml:255#, no-c-formatmsgid """First, you should map the natural key of your entity using <literal><""natural-id></literal>, and enable use of the second-level cache."msgstr """最初に、<literal><natural-id></literal> を使って、 エンティティの自然""キーをマップしてください。 そして、二次キャッシュを有効にします。"#. Tag: programlisting#: query_criteria.xml:260#, 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:262#, no-c-formatmsgid """Note that this functionality is not intended for use with entities with ""<emphasis>mutable</emphasis> natural keys."msgstr """注意: <emphasis>変更される</emphasis> 自然キーを持つエンティティに この機能""を使うのは、意図されていない使い方です。"#. Tag: para#: query_criteria.xml:267#, no-c-formatmsgid "Next, enable the Hibernate query cache."msgstr "次に、Hibernateクエリキャッシュを有効にします。"#. Tag: para#: query_criteria.xml:271#, no-c-formatmsgid """Now, <literal>Restrictions.naturalId()</literal> allows us to make use of ""the more efficient cache algorithm."msgstr """これで、<literal>Restrictions.naturalId()</literal> により、 より効率的な""キャッシュアルゴリズムを使用できます。"#. Tag: programlisting#: query_criteria.xml:276#, 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 + -