|
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.
The Hibernate query_criteria.po source code
# translation of Collection_Mapping.po to
# Xi Huang <xhuang@redhat.com>, 2006.
# Xi HUANG <xhuang@redhat.com>, 2007.
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-03-16 09:53+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 Queries)"
#. Tag: para
#, no-c-format
msgid "Hibernate features an intuitive, extensible criteria query API."
msgstr "具有一个直观的、可扩展的条件查询 API 是 Hibernate 的特色。"
#. 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 Session is a factory for Criteria instances."
msgstr "<literal>org.hibernate.Criteria接口表示特定持久类的一个查询。Session 是 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. The class org.hibernate.criterion.Restrictions defines factory methods for obtaining certain built-in Criterion types."
msgstr "一个单独的查询条件是 <literal>org.hibernate.criterion.Criterion 接口的一个实例。org.hibernate.criterion.Restrictions 类定义了获得某些内置 Criterion 类型的工厂方法。"
#. Tag: para
#, no-c-format
msgid "Restrictions can be grouped logically."
msgstr "约束可以按逻辑分组。 "
#. Tag: para
#, no-c-format
msgid "There are a range of built-in criterion types (<literal>Restrictions subclasses). One of the most useful allows you to specify SQL directly."
msgstr "Hibernate 提供了相当多的内置 criterion 类型(<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 Property by calling Property.forName():"
msgstr "<literal>Property 实例是获得一个条件的另外一种途径。你可以通过调用 Property.forName() 创建一个 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."
msgstr "你可以使用 <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 "通过使用 <literal>createCriteria() 对关联进行导航,你可以指定相关实体的约束。"
#. Tag: para
#, no-c-format
msgid "The second <literal>createCriteria() returns a new instance of Criteria that refers to the elements of the kittens collection."
msgstr "注意第二个 <literal>createCriteria() 返回一个新的 Criteria 实例,该实例引用 kittens 集合中的元素。 "
#. 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 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 not pre-filtered by the criteria. If you want to retrieve just the kittens that match the criteria, you must use a ResultTransformer."
msgstr "<literal>Cat 实例所保存的之前两次查询所返回的 kittens 集合是 没有被条件预过滤的。如果你希望只获得符合条件的 kittens,你必须使用 ResultTransformer。 "
#. Tag: para
#, no-c-format
msgid "Additionally you may manipulate the result set using a left outer join:"
msgstr "此外,你可以用一个 left outer join 来操纵结果集:"
#. 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 "这将返回配偶的名字以 \"good\" 起始的所有 <literal>Cat,并根据其配偶的年龄进行排序。当需要在返回复杂/大型结果集前进行排序或限制、在多个查询必须执行且结果通过 Java 在内存里组合从而删除许多实例时,这很有用。"
#. 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 "第二个查询将需要获取配偶名以 \"good\" 起始并按照配偶年龄排序的猫。"
#. 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
#, no-c-format
msgid "This query will fetch both <literal>mate and kittens by outer join. See for more information."
msgstr "这个查询可以通过外连接抓取 <literal>mate 和 kittens。查看 可以获得更多信息。 "
#. Tag: title
#, no-c-format
msgid "Example queries"
msgstr "查询示例"
#. Tag: para
#, no-c-format
msgid "The class <literal>org.hibernate.criterion.Example 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 "你甚至可以使用 examples 在关联对象上放置条件。"
#. Tag: title
#, no-c-format
msgid "Projections, aggregation and grouping"
msgstr "投影(Projections)、聚合(aggregation)和分组(grouping)"
#. Tag: para
#, no-c-format
msgid "The class <literal>org.hibernate.criterion.Projections is a factory for Projection instances. You can apply a projection to a query by calling setProjection()."
msgstr "<literal>org.hibernate.criterion.Projections 是 Projection 的实例工厂。我们通过调用 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 projections, which also appear in the SQL group by clause."
msgstr "在一个条件查询中没有必要显式的使用 \"group by\" 。某些投影类型就是被定义为<emphasis>分组投影,他们也出现在 SQL 的 group by 子句中。"
#. Tag: para
#, 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 "你可以选择把一个别名指派给一个投影,这样可以使投影值被约束或排序所引用。下面是两种不同的实现方式: "
#. Tag: para
#, no-c-format
msgid "The <literal>alias() and as() methods simply wrap a projection instance in another, aliased, instance of Projection. As a shortcut, you can assign an alias when you add the projection to a projection list:"
msgstr "<literal>alias() 和 as() 方法简便的将一个投影实例包装到另外一个 别名的 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 "离线(detached)查询和子查询"
#. 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 Session."
msgstr "<literal>DetachedCriteria 类使你在一个 session 范围之外创建一个查询,并且可以使用任意的 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 Subqueries or Property."
msgstr "<literal>DetachedCriteria 也可以用以表示子查询。条件实例包含子查询可以通过 Subqueries 或者 Property 获得。 "
#. Tag: para
#, no-c-format
msgid "Correlated subqueries are also possible:"
msgstr "甚至相互关联的子查询也是有可能的: "
#. Tag: title
#, no-c-format
msgid "Queries by natural identifier"
msgstr "根据自然标识查询(Queries by natural identifier)"
#. 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 "对大多数查询,包括条件查询而言,因为查询缓存的失效(invalidation)发生得太频繁,查询缓存不是非常高效。然而,有一种特别的查询,可以通过不变的自然键优化缓存的失效算法。在某些应用中,这种类型的查询比较常见。条件查询 API 对这种用例提供了特别规约。 "
#. Tag: para
#, no-c-format
msgid "First, map the natural key of your entity using <literal><natural-id> and enable use of the second-level cache."
msgstr "首先,你应该对你的 entity 使用 <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>mutable自然键的 entity 并不适用。 "
#. Tag: para
#, no-c-format
msgid "Once you have enabled the Hibernate query cache, the <literal>Restrictions.naturalId() 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:
|