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

📄 query_hql.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 5 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2008-08-14 15:28+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: query_hql.xml:29#, no-c-formatmsgid "HQL: The Hibernate Query Language"msgstr "HQL: Hibernate查询语言"#. Tag: para#: query_hql.xml:31#, no-c-formatmsgid """Hibernate is equipped with an extremely powerful query language that (quite ""intentionally) looks very much like SQL. But don't be fooled by the syntax; ""HQL is fully object-oriented, understanding notions like inheritence, ""polymorphism and association."msgstr """Hibernate配备了一种非常强大的查询语言,这种语言看上去很像SQL。但是不要被语法""结构 上的相似所迷惑,HQL是非常有意识的被设计为完全面向对象的查询,它可以理解""如继承、多态 和关联之类的概念。"#. Tag: title#: query_hql.xml:38#, no-c-formatmsgid "Case Sensitivity"msgstr "大小写敏感性问题"#. Tag: para#: query_hql.xml:40#, no-c-formatmsgid """Queries are case-insensitive, except for names of Java classes and ""properties. So <literal>SeLeCT</literal> is the same as <literal>sELEct</""literal> is the same as <literal>SELECT</literal> but <literal>org.hibernate.""eg.FOO</literal> is not <literal>org.hibernate.eg.Foo</literal> and ""<literal>foo.barSet</literal> is not <literal>foo.BARSET</literal>."msgstr """除了Java类与属性的名称外,查询语句对大小写并不敏感。 所以 <literal>SeLeCT</""literal> 与 <literal>sELEct</literal> 以及 <literal>SELECT</literal> 是相同""的,但是 <literal>org.hibernate.eg.FOO</literal> 并不等价于 <literal>org.""hibernate.eg.Foo</literal> 并且 <literal>foo.barSet</literal> 也不等价于 ""<literal>foo.BARSET</literal>。"#. Tag: para#: query_hql.xml:51#, no-c-formatmsgid """This manual uses lowercase HQL keywords. Some users find queries with ""uppercase keywords more readable, but we find this convention ugly when ""embedded in Java code."msgstr """本手册中的HQL关键字将使用小写字母. 很多用户发现使用完全大写的关键字会使查询语""句 的可读性更强, 但我们发现,当把查询语句嵌入到Java语句中的时候使用大写关键字""比较难看。"#. Tag: title#: query_hql.xml:59#, no-c-formatmsgid "The from clause"msgstr "from子句"#. Tag: para#: query_hql.xml:61#, no-c-formatmsgid "The simplest possible Hibernate query is of the form:"msgstr "Hibernate中最简单的查询语句的形式如下:"#. Tag: programlisting#: query_hql.xml:65#, no-c-formatmsgid "<![CDATA[from eg.Cat]]>"msgstr ""#. Tag: para#: query_hql.xml:67#, no-c-formatmsgid """which simply returns all instances of the class <literal>eg.Cat</literal>. ""We don't usually need to qualify the class name, since <literal>auto-import</""literal> is the default. So we almost always just write:"msgstr """该子句简单的返回<literal>eg.Cat</literal>类的所有实例。 通常我们不需要使用类""的全限定名, 因为 <literal>auto-import</literal>(自动引入) 是缺省的情况。 所""以我们几乎只使用如下的简单写法:"#. Tag: programlisting#: query_hql.xml:73#, no-c-formatmsgid "<![CDATA[from Cat]]>"msgstr ""#. Tag: para#: query_hql.xml:75#, no-c-formatmsgid """Most of the time, you will need to assign an <emphasis>alias</emphasis>, ""since you will want to refer to the <literal>Cat</literal> in other parts of ""the query."msgstr """大多数情况下, 你需要指定一个<emphasis>别名</emphasis>, 原因是你可能需要 在查""询语句的其它部分引用到<literal>Cat</literal>"#. Tag: programlisting#: query_hql.xml:81 query_hql.xml:396#, no-c-formatmsgid "<![CDATA[from Cat as cat]]>"msgstr ""#. Tag: para#: query_hql.xml:83#, no-c-formatmsgid """This query assigns the alias <literal>cat</literal> to <literal>Cat</""literal> instances, so we could use that alias later in the query. The ""<literal>as</literal> keyword is optional; we could also write:"msgstr """这个语句把别名<literal>cat</literal>指定给类<literal>Cat</literal> 的实例, 这""样我们就可以在随后的查询中使用此别名了。 关键字<literal>as</literal> 是可选""的,我们也可以这样写:"#. Tag: programlisting#: query_hql.xml:89#, no-c-formatmsgid "<![CDATA[from Cat cat]]>"msgstr ""#. Tag: para#: query_hql.xml:91#, no-c-formatmsgid """Multiple classes may appear, resulting in a cartesian product or \"cross\" ""join."msgstr """子句中可以同时出现多个类, 其查询结果是产生一个笛卡儿积或产生跨表的连接。"#. Tag: programlisting#: query_hql.xml:95#, no-c-formatmsgid "<![CDATA[from Formula, Parameter]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:96#, no-c-formatmsgid "<![CDATA[from Formula as form, Parameter as param]]>"msgstr ""#. Tag: para#: query_hql.xml:98#, no-c-formatmsgid """It is considered good practice to name query aliases using an initial ""lowercase, consistent with Java naming standards for local variables (eg. ""<literal>domesticCat</literal>)."msgstr """查询语句中别名的开头部分小写被认为是实践中的好习惯, 这样做与Java变量的命名标""准保持了一致 (比如,<literal>domesticCat</literal>)。"#. Tag: title#: query_hql.xml:107#, no-c-formatmsgid "Associations and joins"msgstr "关联(Association)与连接(Join)"#. Tag: para#: query_hql.xml:109#, no-c-formatmsgid """We may also assign aliases to associated entities, or even to elements of a ""collection of values, using a <literal>join</literal>."msgstr """我们也可以为相关联的实体甚至是对一个集合中的全部元素指定一个别名, 这时要使用""关键字<literal>join</literal>。"#. Tag: programlisting#: query_hql.xml:114#, no-c-formatmsgid """<![CDATA[from Cat as cat\n""    inner join cat.mate as mate\n""    left outer join cat.kittens as kitten]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:116#, no-c-formatmsgid "<![CDATA[from Cat as cat left join cat.mate.kittens as kittens]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:118#, no-c-formatmsgid "<![CDATA[from Formula form full join form.parameter param]]>"msgstr ""#. Tag: para#: query_hql.xml:120#, no-c-formatmsgid "The supported join types are borrowed from ANSI SQL"msgstr "受支持的连接类型是从ANSI SQL中借鉴来的。"#. Tag: literal#: query_hql.xml:127#, no-c-formatmsgid "inner join"msgstr "<literal>inner join</literal>(内连接)"#. Tag: literal#: query_hql.xml:132#, no-c-formatmsgid "left outer join"msgstr "<literal>left outer join</literal>(左外连接)"#. Tag: literal#: query_hql.xml:137#, no-c-formatmsgid "right outer join"msgstr "<literal>right outer join</literal>(右外连接)"#. Tag: para#: query_hql.xml:141#, no-c-formatmsgid "<literal>full join</literal> (not usually useful)"msgstr "<literal>full join</literal> (全连接,并不常用)"#. Tag: para#: query_hql.xml:147#, no-c-formatmsgid """The <literal>inner join</literal>, <literal>left outer join</literal> and ""<literal>right outer join</literal> constructs may be abbreviated."msgstr """语句<literal>inner join</literal>, <literal>left outer join</literal> 以及 ""<literal>right outer join</literal> 可以简写。"#. Tag: programlisting#: query_hql.xml:152#, no-c-formatmsgid """<![CDATA[from Cat as cat\n""    join cat.mate as mate\n""    left join cat.kittens as kitten]]>"msgstr ""#. Tag: para#: query_hql.xml:154#, no-c-formatmsgid """You may supply extra join conditions using the HQL <literal>with</literal> ""keyword."msgstr "通过HQL的<literal>with</literal>关键字,你可以提供额外的join条件。"#. Tag: programlisting#: query_hql.xml:159#, no-c-formatmsgid """<![CDATA[from Cat as cat\n""    left join cat.kittens as kitten\n""        with kitten.bodyWeight > 10.0]]>"msgstr ""#. Tag: para#: query_hql.xml:161#, no-c-formatmsgid """In addition, a \"fetch\" join allows associations or collections of values ""to be initialized along with their parent objects, using a single select. ""This is particularly useful in the case of a collection. It effectively ""overrides the outer join and lazy declarations of the mapping file for ""associations and collections. See <xref linkend=\"performance-fetching\"/> ""for more information."msgstr """还有,一个\"fetch\"连接允许仅仅使用一个选择语句就将相关联的对象或一组值的集合""随着他们的父对象的初始化而被初始化,这种方法在使用到集合的情况下尤其有用,对""于关联和集合来说,它有效的代替了映射文件中的外联接 与延迟声明(lazy ""declarations). 查看 <xref linkend=\"performance-fetching\"/> 以获得等多的信""息。"#. Tag: programlisting#: query_hql.xml:169#, no-c-formatmsgid """<![CDATA[from Cat as cat\n""    inner join fetch cat.mate\n""    left join fetch cat.kittens]]>"msgstr ""#. Tag: para#: query_hql.xml:171#, no-c-formatmsgid """A fetch join does not usually need to assign an alias, because the ""associated objects should not be used in the <literal>where</literal> clause ""(or any other clause). Also, the associated objects are not returned ""directly in the query results. Instead, they may be accessed via the parent ""object. The only reason we might need an alias is if we are recursively join ""fetching a further collection:"msgstr """一个fetch连接通常不需要被指定别名, 因为相关联的对象不应当被用在 ""<literal>where</literal> 子句 (或其它任何子句)中。同时,相关联的对象 并不在查""询的结果中直接返回,但可以通过他们的父对象来访问到他们。"#. Tag: programlisting#: query_hql.xml:179#, no-c-formatmsgid """<![CDATA[from Cat as cat\n""    inner join fetch cat.mate\n""    left join fetch cat.kittens child\n""    left join fetch child.kittens]]>"msgstr ""#. Tag: para#: query_hql.xml:181#, no-c-formatmsgid """Note that the <literal>fetch</literal> construct may not be used in queries ""called using <literal>iterate()</literal> (though <literal>scroll()</""literal> can be used). Nor should <literal>fetch</literal> be used together ""with <literal>setMaxResults()</literal> or <literal>setFirstResult()</""literal> as these operations are based on the result rows, which usually ""contain duplicates for eager collection fetching, hence, the number of rows ""is not what you'd expect. Nor may <literal>fetch</literal> be used together ""with an ad hoc <literal>with</literal> condition. It is possible to create a ""cartesian product by join fetching more than one collection in a query, so ""take care in this case. Join fetching multiple collection roles also ""sometimes gives unexpected results for bag mappings, so be careful about how ""you formulate your queries in this case. Finally, note that <literal>full ""join fetch</literal> and <literal>right join fetch</literal> are not ""meaningful."msgstr """假若使用<literal>iterate()</literal>来调用查询,请注意<literal>fetch</""literal>构造是不能使用的(<literal>scroll()</literal> 可以使用)。""<literal>fetch</literal>也不应该与<literal>setMaxResults()</literal> 或""<literal>setFirstResult()</literal>共用,这是因为这些操作是基于结果集的,而在""预先抓取集合类时可能包含重复的数据,也就是说无法预先知道精确的行数。""<literal>fetch</literal>还不能与独立的 <literal>with</literal>条件一起使用。""通过在一次查询中fetch多个集合,可以制造出笛卡尔积,因此请多加注意。对bag映射""来说,同时join fetch多个集合角色可能在某些情况下给出并非预期的结果,也请小""心。最后注意,使用<literal>full join fetch</literal> 与 <literal>right join ""fetch</literal>是没有意义的。"#. Tag: para#: query_hql.xml:196#, no-c-formatmsgid """If you are using property-level lazy fetching (with bytecode ""instrumentation), it is possible to force Hibernate to fetch the lazy ""properties immediately (in the first query) using <literal>fetch all ""properties</literal>."msgstr """如果你使用属性级别的延迟获取(lazy fetching)(这是通过重新编写字节码实现""的),可以使用 <literal>fetch all properties</literal> 来强制Hibernate立即取""得那些原本需要延迟加载的属性(在第一个查询中)。"#. Tag: programlisting#: query_hql.xml:202#, no-c-formatmsgid "<![CDATA[from Document fetch all properties order by name]]>"msgstr ""#. Tag: programlisting#: query_hql.xml:203#, no-c-formatmsgid """<![CDATA[from Document doc fetch all properties where lower(doc.name) like '%""cats%']]>"msgstr ""#. Tag: title#: query_hql.xml:208#, no-c-formatmsgid "Forms of join syntax"msgstr "join 语法的形式"#. Tag: para#: query_hql.xml:210#, no-c-formatmsgid """HQL supports two forms of association joining: <literal>implicit</literal> ""and <literal>explicit</literal>."msgstr """HQL支持两种关联join的形式:<literal>implicit(隐式)</literal> 与""<literal>explicit(显式)</literal>。"#. Tag: para#: query_hql.xml:214#, no-c-formatmsgid """The queries shown in the previous section all use the <literal>explicit</""literal> form where the join keyword is explicitly used in the from clause. ""This is the recommended form."msgstr """上一节中给出的查询都是使用<literal>explicit(显式)</literal>形式的,其中form子""句中明确给出了join关键字。这是建议使用的方式。"#. Tag: para

⌨️ 快捷键说明

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