alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (query_criteria.po)

This example Hibernate source code file (query_criteria.po) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

cat, cdata, cdata, f, fritz, integer, integer, izi, list, list, tag, tag, the, you

The Hibernate query_criteria.po source code

# translation of Collection_Mapping.po to
# Xi HUANG <xhuang@redhat.com>, 2007, 2010.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-11T05:38:15\n"
"PO-Revision-Date: 2010-01-18 13:38+1000\n"
"Last-Translator: Xi HUANG <xhuang@redhat.com>\n"
"Language-Team:  <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"

#. Tag: title
#, no-c-format
msgid "Criteria Queries"
msgstr "Criteria クエリ"

#. Tag: para
#, no-c-format
msgid "Hibernate features an intuitive, extensible criteria query API."
msgstr ""
"Hibernate には、直感的で拡張可能な criteria クエリ API が用意されています。"

#. Tag: title
#, no-c-format
msgid "Creating a <literal>Criteria instance"
msgstr "<literal>Criteria インスタンスの作成"

#. Tag: para
#, no-c-format
msgid ""
"The interface <literal>org.hibernate.Criteria represents a query "
"against a particular persistent class. The <literal>Session is a "
"factory for <literal>Criteria instances."
msgstr ""
"<literal>org.hibernate.Criteria インターフェースは特定の永続性クラ"
"スに対するクエリを表現します。 <literal>Session は "
"<literal>Criteria インスタンスのファクトリです。"

#. Tag: title
#, no-c-format
msgid "Narrowing the result set"
msgstr "リザルトセットの絞込み"

#. Tag: para
#, no-c-format
msgid ""
"An individual query criterion is an instance of the interface <literal>org."
"hibernate.criterion.Criterion</literal>. The class org.hibernate."
"criterion.Restrictions</literal> defines factory methods for obtaining "
"certain built-in <literal>Criterion types."
msgstr ""
"<literal>org.hibernate.criterion.Criterion インターフェースのインス"
"タンスは、個別のクエリクライテリオン(問い合わせの判定基準)を表します。 "
"<literal>org.hibernate.criterion.Restrictions クラスは、ある組み込"
"みの <literal>Criterion 型を取得するためのファクトリメソッドを持っ"
"ています。"

#. Tag: para
#, no-c-format
msgid "Restrictions can be grouped logically."
msgstr "Restriction (限定)は、論理的にグループ化できます。"

#. Tag: para
#, no-c-format
msgid ""
"There are a range of built-in criterion types (<literal>Restrictions のサブクラス) はかな"
"りの範囲に及びますが、特に有用なのは SQL を直接指定できるものです。"

#. Tag: para
#, no-c-format
msgid ""
"The <literal>{alias} placeholder with be replaced by the row alias "
"of the queried entity."
msgstr ""
"<literal>{alias} というプレースホルダは、問い合わせを受けたエンティ"
"ティの行の別名によって置き換えられます。"

#. Tag: para
#, no-c-format
msgid ""
"You can also obtain a criterion from a <literal>Property instance. "
"You can create a <literal>Property by calling Property."
"forName()</literal>:"
msgstr ""
"criterion を得る別の手段は、 <literal>Property インスタンスから取得"
"することです。 <literal>Property.forName() を呼び出して、 "
"<literal>Property インスタンスを作成できます。"

#. Tag: title
#, no-c-format
msgid "Ordering the results"
msgstr "結果の整列"

#. Tag: para
#, no-c-format
msgid ""
"You can order the results using <literal>org.hibernate.criterion.Order を使って結果を並び替えること"
"ができます。"

#. Tag: title
#, no-c-format
msgid "Associations"
msgstr "関連"

#. Tag: para
#, no-c-format
msgid ""
"By navigating associations using <literal>createCriteria() you can "
"specify constraints upon related entities:"
msgstr ""

#. Tag: para
#, no-c-format
msgid ""
"The second <literal>createCriteria() returns a new instance of "
"<literal>Criteria that refers to the elements of the "
"<literal>kittens collection."
msgstr ""
"2番目の <literal>createCriteria() は、 kittens "
"コレクションの要素を参照する新しい <literal>Criteria インスタンスを"
"返すことに注意してください。"

#. Tag: para
#, no-c-format
msgid ""
"There is also an alternate form that is useful in certain circumstances:"
msgstr "以下のような方法も、状況により有用です。"

#. Tag: para
#, no-c-format
msgid ""
"(<literal>createAlias() does not create a new instance of "
"<literal>Criteria.)"
msgstr ""
"(<literal>createAlias() は新しい Criteria イン"
"スタンスを作成しません。)"

#. Tag: para
#, no-c-format
msgid ""
"The kittens collections held by the <literal>Cat instances "
"returned by the previous two queries are <emphasis>not pre-"
"filtered by the criteria. If you want to retrieve just the kittens that "
"match the criteria, you must use a <literal>ResultTransformer."
msgstr ""
"前の2つのクエリによって返される <literal>Cat インスタンスによって保"
"持される kittens コレクションは、 criteria によって事前にフィルタリング "
"<emphasis>されない ことに注意してください。もし criteria に適合す"
"る kitten を取得したいなら、 <literal>ResultTransformer を使わなけ"
"ればなりません。"

#. Tag: para
#, no-c-format
msgid "Additionally you may manipulate the result set using a left outer join:"
msgstr ""

#. Tag: para
#, no-c-format
msgid ""
"This will return all of the <literal>Cats with a mate whose name "
"starts with \"good\" ordered by their mate's age, and all cats who do not "
"have a mate. This is useful when there is a need to order or limit in the "
"database prior to returning complex/large result sets, and removes many "
"instances where multiple queries would have to be performed and the results "
"unioned by java in memory."
msgstr ""

#. Tag: para
#, no-c-format
msgid ""
"Without this feature, first all of the cats without a mate would need to be "
"loaded in one query."
msgstr ""

#. Tag: para
#, no-c-format
msgid ""
"A second query would need to retreive the cats with mates who's name started "
"with \"good\" sorted by the mates age."
msgstr ""

#. Tag: para
#, no-c-format
msgid "Thirdly, in memory; the lists would need to be joined manually."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Dynamic association fetching"
msgstr "関連の動的フェッチ"

#. Tag: para
#, no-c-format
msgid ""
"You can specify association fetching semantics at runtime using "
"<literal>setFetchMode()."
msgstr ""
"<literal>setFetchMode() を使い、実行時に関連の復元方法を指定しても"
"よいです。"

#. Tag: para
#, fuzzy, no-c-format
msgid ""
"This query will fetch both <literal>mate and kittens for "
"more information."
msgstr ""
"このクエリは外部結合により <literal>matekittens allows you to "
"construct a query criterion from a given instance."
msgstr ""
"<literal>org.hibernate.criterion.Example クラスは、与えられたインス"
"タンスからクエリクライテリオンを構築できます。"

#. Tag: para
#, no-c-format
msgid ""
"Version properties, identifiers and associations are ignored. By default, "
"null valued properties are excluded."
msgstr ""
"バージョンプロパティ、識別子、関連は無視されます。デフォルトでは null 値のプ"
"ロパティは除外されます。"

#. Tag: para
#, no-c-format
msgid "You can adjust how the <literal>Example is applied."
msgstr ""
"どのように <literal>Example を適用するか調整することができます。"

#. Tag: para
#, no-c-format
msgid "You can even use examples to place criteria upon associated objects."
msgstr ""
"関連オブジェクトに criteria を指定するために、 example を使うことも可能です。"

#. Tag: title
#, no-c-format
msgid "Projections, aggregation and grouping"
msgstr "射影、集約、グループ化"

#. Tag: para
#, no-c-format
msgid ""
"The class <literal>org.hibernate.criterion.Projections is a "
"factory for <literal>Projection instances. You can apply a "
"projection to a query by calling <literal>setProjection()."
msgstr ""
"<literal>org.hibernate.criterion.Projections クラスは "
"<literal>Projection インスタンスのファクトリです。 "
"<literal>setProjection() を呼び出すことで、クエリに射影を適用しま"
"す。"

#. Tag: para
#, no-c-format
msgid ""
"There is no explicit \"group by\" necessary in a criteria query. Certain "
"projection types are defined to be <emphasis>grouping projectionsgroup by clause."
msgstr ""
"必要であっても、 criteria クエリに「group by」を明示する必要はありません。あ"
"る種の Projection 型は <emphasis>グループ化射影 として定義され、 "
"SQL の <literal>group by 節にも現れます。"

#. Tag: para
#, fuzzy, no-c-format
msgid ""
"An alias can be assigned to a projection so that the projected value can be "
"referred to in restrictions or orderings. Here are two different ways to do "
"this:"
msgstr ""
"任意で射影に別名を付けられるため、射影される値は restriction や ordering 内か"
"ら参照できます。別名をつける2つの異なる方法を示します:"

#. Tag: para
#, no-c-format
msgid ""
"The <literal>alias() and as() methods simply "
"wrap a projection instance in another, aliased, instance of "
"<literal>Projection. As a shortcut, you can assign an alias when "
"you add the projection to a projection list:"
msgstr ""
"<literal>alias() と as() メソッドは、 "
"Projection インスタンスを別の名前の <literal>Projection インスタン"
"スでラップするだけです。ショートカットとして、射影を射影リストに追加する際"
"に、別名をつけられます:"

#. Tag: para
#, no-c-format
msgid ""
"You can also use <literal>Property.forName() to express "
"projections:"
msgstr "射影の式に <literal>Property.forName() も使用できます:"

#. Tag: title
#, no-c-format
msgid "Detached queries and subqueries"
msgstr "クエリおよびサブクエリの分離"

#. Tag: para
#, no-c-format
msgid ""
"The <literal>DetachedCriteria class allows you to create a query "
"outside the scope of a session and then execute it using an arbitrary "
"<literal>Session."
msgstr ""
"<literal>DetachedCriteria クラスにより、セッションスコープ外にクエ"
"リを作成できます。後で、任意の <literal>Session を使って、実行でき"
"ます。"

#. Tag: para
#, no-c-format
msgid ""
"A <literal>DetachedCriteria can also be used to express a "
"subquery. Criterion instances involving subqueries can be obtained via "
"<literal>Subqueries or Property."
msgstr ""
"<literal>DetachedCriteria は、サブクエリを表現するためにも使えま"
"す。サブクエリを伴う Criterion インスタンスは、 <literal>SubqueriesProperty から得られます。"

#. Tag: para
#, no-c-format
msgid "Correlated subqueries are also possible:"
msgstr "相互関係があるサブクエリでさえも可能です:"

#. Tag: title
#, no-c-format
msgid "Queries by natural identifier"
msgstr "自然識別子によるクエリ"

#. Tag: para
#, no-c-format
msgid ""
"For most queries, including criteria queries, the query cache is not "
"efficient because query cache invalidation occurs too frequently. However, "
"there is a special kind of query where you 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
#, no-c-format
msgid ""
"First, map the natural key of your entity using <literal><natural-id> を使って、エンティティの自然"
"キーをマップしてください。そして、二次キャッシュを有効にします。"

#. Tag: para
#, no-c-format
msgid ""
"This functionality is not intended for use with entities with "
"<emphasis>mutable natural keys."
msgstr ""
"注記: <emphasis>変更される 自然キーを持つエンティティにこの機能を"
"使うのは、意図されていない使い方です。"

#. Tag: para
#, no-c-format
msgid ""
"Once you have enabled the Hibernate query cache, the <literal>Restrictions."
"naturalId()</literal> allows you to make use of the more efficient cache "
"algorithm."
msgstr ""
"これで、 <literal>Restrictions.naturalId() により、より効率的な"
"キャッシュアルゴリズムを使用できます。"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[Criteria crit = sess.createCriteria(Cat.class);\n"
#~ "crit.setMaxResults(50);\n"
#~ "List cats = crit.list();]]>"
#~ msgstr ""
#~ "Criteria crit = sess.createCriteria(Cat.class);\n"
#~ "crit.setMaxResults(50);\n"
#~ "List cats = crit.list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
#~ "    .add( Restrictions.between(\"weight\", minWeight, maxWeight) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
#~ "    .add( Restrictions.between(\"weight\", minWeight, maxWeight) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
#~ "    .add( Restrictions.or(\n"
#~ "        Restrictions.eq( \"age\", new Integer(0) ),\n"
#~ "        Restrictions.isNull(\"age\")\n"
#~ "    ) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
#~ "    .add( Restrictions.or(\n"
#~ "        Restrictions.eq( \"age\", new Integer(0) ),\n"
#~ "        Restrictions.isNull(\"age\")\n"
#~ "    ) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.in( \"name\", new String[] { \"Fritz\", \"Izi\", "
#~ "\"Pk\" } ) )\n"
#~ "    .add( Restrictions.disjunction()\n"
#~ "        .add( Restrictions.isNull(\"age\") )\n"
#~ "        .add( Restrictions.eq(\"age\", new Integer(0) ) )\n"
#~ "        .add( Restrictions.eq(\"age\", new Integer(1) ) )\n"
#~ "        .add( Restrictions.eq(\"age\", new Integer(2) ) )\n"
#~ "    ) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.in( \"name\", new String[] { \"Fritz\", \"Izi\", "
#~ "\"Pk\" } ) )\n"
#~ "    .add( Restrictions.disjunction()\n"
#~ "        .add( Restrictions.isNull(\"age\") )\n"
#~ "        .add( Restrictions.eq(\"age\", new Integer(0) ) )\n"
#~ "        .add( Restrictions.eq(\"age\", new Integer(1) ) )\n"
#~ "        .add( Restrictions.eq(\"age\", new Integer(2) ) )\n"
#~ "    ) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.sqlRestriction(\"lower({alias}.name) like lower(?)"
#~ "\", \"Fritz%\", Hibernate.STRING) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.sqlRestriction(\"lower({alias}.name) like lower(?)"
#~ "\", \"Fritz%\", \n"
#~ "        Hibernate.STRING) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[\n"
#~ "Property age = Property.forName(\"age\");\n"
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.disjunction()\n"
#~ "        .add( age.isNull() )\n"
#~ "        .add( age.eq( new Integer(0) ) )\n"
#~ "        .add( age.eq( new Integer(1) ) )\n"
#~ "        .add( age.eq( new Integer(2) ) )\n"
#~ "    ) )\n"
#~ "    .add( Property.forName(\"name\").in( new String[] { \"Fritz\", \"Izi"
#~ "\", \"Pk\" } ) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "Property age = Property.forName(\"age\");\n"
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.disjunction()\n"
#~ "        .add( age.isNull() )\n"
#~ "        .add( age.eq( new Integer(0) ) )\n"
#~ "        .add( age.eq( new Integer(1) ) )\n"
#~ "        .add( age.eq( new Integer(2) ) )\n"
#~ "    ) )\n"
#~ "    .add( Property.forName(\"name\").in( new String[] { \"Fritz\", \"Izi"
#~ "\", \"Pk\" } ) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"F%\")\n"
#~ "    .addOrder( Order.asc(\"name\") )\n"
#~ "    .addOrder( Order.desc(\"age\") )\n"
#~ "    .setMaxResults(50)\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"F%\")\n"
#~ "    .addOrder( Order.asc(\"name\") )\n"
#~ "    .addOrder( Order.desc(\"age\") )\n"
#~ "    .setMaxResults(50)\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Property.forName(\"name\").like(\"F%\") )\n"
#~ "    .addOrder( Property.forName(\"name\").asc() )\n"
#~ "    .addOrder( Property.forName(\"age\").desc() )\n"
#~ "    .setMaxResults(50)\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Property.forName(\"name\").like(\"F%\") )\n"
#~ "    .addOrder( Property.forName(\"name\").asc() )\n"
#~ "    .addOrder( Property.forName(\"age\").desc() )\n"
#~ "    .setMaxResults(50)\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"F%\") )\n"
#~ "    .createCriteria(\"kittens\")\n"
#~ "        .add( Restrictions.like(\"name\", \"F%\") )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"F%\") )\n"
#~ "    .createCriteria(\"kittens\")\n"
#~ "        .add( Restrictions.like(\"name\", \"F%\") )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .createAlias(\"kittens\", \"kt\")\n"
#~ "    .createAlias(\"mate\", \"mt\")\n"
#~ "    .add( Restrictions.eqProperty(\"kt.name\", \"mt.name\") )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .createAlias(\"kittens\", \"kt\")\n"
#~ "    .createAlias(\"mate\", \"mt\")\n"
#~ "    .add( Restrictions.eqProperty(\"kt.name\", \"mt.name\") )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .createCriteria(\"kittens\", \"kt\")\n"
#~ "        .add( Restrictions.eq(\"name\", \"F%\") )\n"
#~ "    .setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP)\n"
#~ "    .list();\n"
#~ "Iterator iter = cats.iterator();\n"
#~ "while ( iter.hasNext() ) {\n"
#~ "    Map map = (Map) iter.next();\n"
#~ "    Cat cat = (Cat) map.get(Criteria.ROOT_ALIAS);\n"
#~ "    Cat kitten = (Cat) map.get(\"kt\");\n"
#~ "}]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .createCriteria(\"kittens\", \"kt\")\n"
#~ "        .add( Restrictions.eq(\"name\", \"F%\") )\n"
#~ "    .setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP)\n"
#~ "    .list();\n"
#~ "Iterator iter = cats.iterator();\n"
#~ "while ( iter.hasNext() ) {\n"
#~ "    Map map = (Map) iter.next();\n"
#~ "    Cat cat = (Cat) map.get(Criteria.ROOT_ALIAS);\n"
#~ "    Cat kitten = (Cat) map.get(\"kt\");\n"
#~ "}"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
#~ "    .setFetchMode(\"mate\", FetchMode.EAGER)\n"
#~ "    .setFetchMode(\"kittens\", FetchMode.EAGER)\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List cats = sess.createCriteria(Cat.class)\n"
#~ "    .add( Restrictions.like(\"name\", \"Fritz%\") )\n"
#~ "    .setFetchMode(\"mate\", FetchMode.EAGER)\n"
#~ "    .setFetchMode(\"kittens\", FetchMode.EAGER)\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[Cat cat = new Cat();\n"
#~ "cat.setSex('F');\n"
#~ "cat.setColor(Color.BLACK);\n"
#~ "List results = session.createCriteria(Cat.class)\n"
#~ "    .add( Example.create(cat) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "Cat cat = new Cat();\n"
#~ "cat.setSex('F');\n"
#~ "cat.setColor(Color.BLACK);\n"
#~ "List results = session.createCriteria(Cat.class)\n"
#~ "    .add( Example.create(cat) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List results = session.createCriteria(Cat.class)\n"
#~ "    .add( Example.create(cat) )\n"
#~ "    .createCriteria(\"mate\")\n"
#~ "        .add( Example.create( cat.getMate() ) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List results = session.createCriteria(Cat.class)\n"
#~ "    .add( Example.create(cat) )\n"
#~ "    .createCriteria(\"mate\")\n"
#~ "        .add( Example.create( cat.getMate() ) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Projections.rowCount() )\n"
#~ "    .add( Restrictions.eq(\"color\", Color.BLACK) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Projections.rowCount() )\n"
#~ "    .add( Restrictions.eq(\"color\", Color.BLACK) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Projections.alias( Projections.groupProperty(\"color"
#~ "\"), \"colr\" ) )\n"
#~ "    .addOrder( Order.asc(\"colr\") )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Projections.alias( Projections.groupProperty(\"color"
#~ "\"), \"colr\" ) )\n"
#~ "    .addOrder( Order.asc(\"colr\") )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Projections.groupProperty(\"color\").as(\"colr\") )\n"
#~ "    .addOrder( Order.asc(\"colr\") )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Projections.groupProperty(\"color\").as(\"colr\") )\n"
#~ "    .addOrder( Order.asc(\"colr\") )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Property.forName(\"name\") )\n"
#~ "    .add( Property.forName(\"color\").eq(Color.BLACK) )\n"
#~ "    .list();]]>"
#~ msgstr ""
#~ "List results = session.createCriteria(Cat.class)\n"
#~ "    .setProjection( Property.forName(\"name\") )\n"
#~ "    .add( Property.forName(\"color\").eq(Color.BLACK) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "DetachedCriteria weights = DetachedCriteria.forClass(Cat.class)\n"
#~ "    .setProjection( Property.forName(\"weight\") );\n"
#~ "session.createCriteria(Cat.class)\n"
#~ "    .add( Subqueries.geAll(\"weight\", weights) )\n"
#~ "    .list();"

#, fuzzy
#~ msgid ""
#~ "<![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 ""
#~ "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();"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[session.createCriteria(User.class)\n"
#~ "    .add( Restrictions.naturalId()\n"
#~ "        .set(\"name\", \"gavin\")\n"
#~ "        .set(\"org\", \"hb\") \n"
#~ "    ).setCacheable(true)\n"
#~ "    .uniqueResult();]]>"
#~ msgstr ""
#~ "session.createCriteria(User.class)\n"
#~ "    .add( Restrictions.naturalId()\n"
#~ "        .set(\"name\", \"gavin\")\n"
#~ "        .set(\"org\", \"hb\") \n"
#~ "    ).setCacheable(true)\n"
#~ "    .uniqueResult();"

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate query_criteria.po source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.