📄 query_hql.po
字号:
#: query_hql.xml:219#, no-c-formatmsgid """The <literal>implicit</literal> form does not use the join keyword. Instead, ""the associations are \"dereferenced\" using dot-notation. <literal>implicit</""literal> joins can appear in any of the HQL clauses. <literal>implicit</""literal> join result in inner joins in the resulting SQL statement."msgstr """<literal>implicit(隐式)</literal>形式不使用join关键字。关联使用\"点号\"来进""行“引用”。<literal>implicit</literal> join可以在任何HQL子句中出现.""<literal>implicit</literal> join在最终的SQL语句中以inner join的方式出现。"#. Tag: programlisting#: query_hql.xml:226#, no-c-formatmsgid "<![CDATA[from Cat as cat where cat.mate.name like '%s%']]>"msgstr ""#. Tag: title#: query_hql.xml:230#, no-c-formatmsgid "Refering to identifier property"msgstr "Refering to identifier property"#. Tag: para#: query_hql.xml:232#, no-c-formatmsgid """There are, generally speaking, 2 ways to refer to an entity's identifier ""property:"msgstr """There are, generally speaking, 2 ways to refer to an entity's identifier ""property:"#. Tag: para#: query_hql.xml:237#, no-c-formatmsgid """The special property (lowercase) <literal>id</literal> may be used to ""reference the identifier property of an entity <emphasis>provided that ""entity does not define a non-identifier property named id</emphasis>."msgstr """The special property (lowercase) <literal>id</literal> may be used to ""reference the identifier property of an entity <emphasis>provided that ""entity does not define a non-identifier property named id</emphasis>."#. Tag: para#: query_hql.xml:244#, no-c-formatmsgid """If the entity defines a named identifier property, you may use that property ""name."msgstr """If the entity defines a named identifier property, you may use that property ""name."#. Tag: para#: query_hql.xml:250#, no-c-formatmsgid """References to composite identifier properties follow the same naming rules. ""If the entity has a non-identifier property named id, the composite ""identifier property can only be referenced by its defined named; otherwise, ""the special <literal>id</literal> property can be used to rerference the ""identifier property."msgstr """References to composite identifier properties follow the same naming rules. ""If the entity has a non-identifier property named id, the composite ""identifier property can only be referenced by its defined named; otherwise, ""the special <literal>id</literal> property can be used to rerference the ""identifier property."#. Tag: para#: query_hql.xml:257#, fuzzy, no-c-formatmsgid """Note: this has changed significantly starting in version 3.2.2. In previous ""versions, <literal>id</literal> <emphasis>always</emphasis> referred to the ""identifier property no matter what its actual name. A ramification of that ""decision was that non-identifier properties named <literal>id</literal> ""could never be referenced in Hibernate queries."msgstr """Note: this has changed significantly starting in version 3.2.2. In previous ""versions, <literal>id</literal><emphasis>always</emphasis> referred to the ""identifier property no matter what its actual name. A ramification of that ""decision was that non-identifier properties named <literal>id</literal> ""could never be referenced in Hibernate queries."#. Tag: title#: query_hql.xml:266#, no-c-formatmsgid "The select clause"msgstr "select子句"#. Tag: para#: query_hql.xml:268#, no-c-formatmsgid """The <literal>select</literal> clause picks which objects and properties to ""return in the query result set. Consider:"msgstr """<literal>select</literal> 子句选择将哪些对象与属性返 回到查询结果集中. 考虑如""下情况:"#. Tag: programlisting#: query_hql.xml:273#, no-c-formatmsgid """<![CDATA[select mate\n""from Cat as cat\n"" inner join cat.mate as mate]]>"msgstr ""#. Tag: para#: query_hql.xml:275#, no-c-formatmsgid """The query will select <literal>mate</literal>s of other <literal>Cat</""literal>s. Actually, you may express this query more compactly as:"msgstr """该语句将选择<literal>mate</literal>s of other <literal>Cat</literal>s。(其他""猫的配偶) 实际上, 你可以更简洁的用以下的查询语句表达相同的含义:"#. Tag: programlisting#: query_hql.xml:280#, no-c-formatmsgid "<![CDATA[select cat.mate from Cat cat]]>"msgstr ""#. Tag: para#: query_hql.xml:282#, no-c-formatmsgid """Queries may return properties of any value type including properties of ""component type:"msgstr """查询语句可以返回值为任何类型的属性,包括返回类型为某种组件(Component)的属性:"#. Tag: programlisting#: query_hql.xml:286#, no-c-formatmsgid """<![CDATA[select cat.name from DomesticCat cat\n""where cat.name like 'fri%']]>"msgstr ""#. Tag: programlisting#: query_hql.xml:288#, no-c-formatmsgid "<![CDATA[select cust.name.firstName from Customer as cust]]>"msgstr ""#. Tag: para#: query_hql.xml:290#, no-c-formatmsgid """Queries may return multiple objects and/or properties as an array of type ""<literal>Object[]</literal>,"msgstr """查询语句可以返回多个对象和(或)属性,存放在 <literal>Object[]</literal>队列""中,"#. Tag: programlisting#: query_hql.xml:295#, no-c-formatmsgid """<![CDATA[select mother, offspr, mate.name\n""from DomesticCat as mother\n"" inner join mother.mate as mate\n"" left outer join mother.kittens as offspr]]>"msgstr ""#. Tag: para#: query_hql.xml:297#, no-c-formatmsgid "or as a <literal>List</literal>,"msgstr "或存放在一个<literal>List</literal>对象中,"#. Tag: programlisting#: query_hql.xml:301#, no-c-formatmsgid """<![CDATA[select new list(mother, offspr, mate.name)\n""from DomesticCat as mother\n"" inner join mother.mate as mate\n"" left outer join mother.kittens as offspr]]>"msgstr ""#. Tag: para#: query_hql.xml:303#, no-c-formatmsgid "or as an actual typesafe Java object,"msgstr "也可能直接返回一个实际的类型安全的Java对象,"#. Tag: programlisting#: query_hql.xml:307#, no-c-formatmsgid """<![CDATA[select new Family(mother, mate, offspr)\n""from DomesticCat as mother\n"" join mother.mate as mate\n"" left join mother.kittens as offspr]]>"msgstr ""#. Tag: para#: query_hql.xml:309#, no-c-formatmsgid """assuming that the class <literal>Family</literal> has an appropriate ""constructor."msgstr "假设类<literal>Family</literal>有一个合适的构造函数."#. Tag: para#: query_hql.xml:313#, no-c-formatmsgid """You may assign aliases to selected expressions using <literal>as</literal>:"msgstr "你可以使用关键字<literal>as</literal>给“被选择了的表达式”指派别名:"#. Tag: programlisting#: query_hql.xml:317#, no-c-formatmsgid """<![CDATA[select max(bodyWeight) as max, min(bodyWeight) as min, count(*) as ""n\n""from Cat cat]]>"msgstr ""#. Tag: para#: query_hql.xml:319#, no-c-formatmsgid """This is most useful when used together with <literal>select new map</""literal>:"msgstr "这种做法在与子句<literal>select new map</literal>一起使用时最有用:"#. Tag: programlisting#: query_hql.xml:323#, no-c-formatmsgid """<![CDATA[select new map( max(bodyWeight) as max, min(bodyWeight) as min, ""count(*) as n )\n""from Cat cat]]>"msgstr ""#. Tag: para#: query_hql.xml:325#, no-c-formatmsgid """This query returns a <literal>Map</literal> from aliases to selected values."msgstr """该查询返回了一个<literal>Map</literal>的对象,内容是别名与被选择的值组成的名-""值映射。"#. Tag: title#: query_hql.xml:332#, no-c-formatmsgid "Aggregate functions"msgstr "聚集函数"#. Tag: para#: query_hql.xml:334#, no-c-formatmsgid """HQL queries may even return the results of aggregate functions on properties:"msgstr "HQL查询甚至可以返回作用于属性之上的聚集函数的计算结果:"#. Tag: programlisting#: query_hql.xml:338#, no-c-formatmsgid """<![CDATA[select avg(cat.weight), sum(cat.weight), max(cat.weight), count""(cat)\n""from Cat cat]]>"msgstr ""#. Tag: para#: query_hql.xml:349#, no-c-formatmsgid "The supported aggregate functions are"msgstr "受支持的聚集函数如下:"#. Tag: literal#: query_hql.xml:356#, no-c-formatmsgid "avg(...), sum(...), min(...), max(...)"msgstr "avg(...), sum(...), min(...), max(...)"#. Tag: literal#: query_hql.xml:361#, no-c-formatmsgid "count(*)"msgstr "count(*)"#. Tag: literal#: query_hql.xml:366#, no-c-formatmsgid "count(...), count(distinct ...), count(all...)"msgstr "count(...), count(distinct ...), count(all...)"#. Tag: para#: query_hql.xml:371#, no-c-formatmsgid """You may use arithmetic operators, concatenation, and recognized SQL ""functions in the select clause:"msgstr "你可以在选择子句中使用数学操作符、连接以及经过验证的SQL函数:"#. Tag: programlisting#: query_hql.xml:376#, no-c-formatmsgid """<![CDATA[select cat.weight + sum(kitten.weight)\n""from Cat cat\n"" join cat.kittens kitten\n""group by cat.id, cat.weight]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:378#, no-c-formatmsgid """<![CDATA[select firstName||' '||initial||' '||upper(lastName) from Person]]>"msgstr ""#. Tag: para#: query_hql.xml:380#, no-c-formatmsgid """The <literal>distinct</literal> and <literal>all</literal> keywords may be ""used and have the same semantics as in SQL."msgstr """关键字<literal>distinct</literal>与<literal>all</literal> 也可以使用,它们具""有与SQL相同的语义."#. Tag: programlisting#: query_hql.xml:385#, no-c-formatmsgid """<![CDATA[select distinct cat.name from Cat cat\n""\n""select count(distinct cat.name), count(cat) from Cat cat]]>"msgstr ""#. Tag: title#: query_hql.xml:390#, no-c-formatmsgid "Polymorphic queries"msgstr "多态查询"#. Tag: para#: query_hql.xml:392#, no-c-formatmsgid "A query like:"msgstr "一个如下的查询语句:"#. Tag: para#: query_hql.xml:398#, no-c-formatmsgid """returns instances not only of <literal>Cat</literal>, but also of subclasses ""like <literal>DomesticCat</literal>. Hibernate queries may name ""<emphasis>any</emphasis> Java class or interface in the <literal>from</""literal> clause. The query will return instances of all persistent classes ""that extend that class or implement the interface. The following query would ""return all persistent objects:"msgstr """不仅返回<literal>Cat</literal>类的实例, 也同时返回子类 <literal>DomesticCat</""literal>的实例. Hibernate 可以在<literal>from</literal>子句中指定<emphasis>任""何</emphasis> Java 类或接口. 查询会返回继承了该类的所有持久化子类 的实例或返""回声明了该接口的所有持久化类的实例。下面的查询语句返回所有的被持久化的对象:"#. Tag: programlisting#: query_hql.xml:406#, no-c-formatmsgid "<![CDATA[from java.lang.Object o]]>"msgstr ""#. Tag: para#: query_hql.xml:408#, no-c-formatmsgid """The interface <literal>Named</literal> might be implemented by various ""persistent classes:"msgstr "接口<literal>Named</literal> 可能被各种各样的持久化类声明:"#. Tag: programlisting#: query_hql.xml:413#, no-c-formatmsgid "<![CDATA[from Named n, Named m where n.name = m.name]]>"msgstr ""#. Tag: para#: query_hql.xml:415#, no-c-formatmsgid """Note that these last two queries will require more than one SQL ""<literal>SELECT</literal>. This means that the <literal>order by</literal> ""clause does not correctly order the whole result set. (It also means you ""can't call these queries using <literal>Query.scroll()</literal>.)"msgstr """注意,最后的两个查询将需要超过一个的SQL <literal>SELECT</literal>.这表明""<literal>order by</literal>子句 没有对整个结果集进行正确的排序. (这也说明你不""能对这样的查询使用<literal>Query.scroll()</literal>方法.)"#. Tag: title#: query_hql.xml:424
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -