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

📄 collection_mapping.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 5 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 01:01+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#: collection_mapping.xml:5#, no-c-formatmsgid "Collection Mapping"msgstr "集合类(Collections)映射"#. Tag: title#: collection_mapping.xml:8#, no-c-formatmsgid "Persistent collections"msgstr "持久化集合类(Persistent collections)"#. Tag: para#: collection_mapping.xml:10#, no-c-formatmsgid """Hibernate requires that persistent collection-valued fields be declared as ""an interface type, for example:"msgstr """Hibernate要求持久化集合值字段必须声明为接口,比如:(译者注:在阅读本章的时""候,以后整个手册的阅读过程中,我们都会面临一个名词方面的问题,那就是“集合”。""\"Collections\"和\"Set\"在中文里对应都被翻译为“集合”,但是他们的含义很不一""样。Collections是一个超集,Set是其中的一种。大部分情况下,本译稿中泛指的未加""英文注明的“集合”,都应当理解为“Collections”。在有些二者同时出现,可能造成混淆""的地方,我们用“集合类”来特指“Collecions”,“集合(Set)”来指\"Set\",一般都会在后""面的括号中给出英文。希望大家在阅读时联系上下文理解,不要造成误解。 与此同""时,“元素”一词对应的英文“element”,也有两个不同的含义。其一为集合的元素,是内""存中的一个变量;另一含义则是XML文档中的一个标签所代表的元素。也请注意区别。 ""本章中,特别是后半部分是需要反复阅读才能理解清楚的。如果遇到任何疑问,请记住,英""文版本的reference是惟一标准的参考资料。)"#. Tag: programlisting#: collection_mapping.xml:15#, no-c-formatmsgid """<![CDATA[public class Product {\n""    private String serialNumber;\n""    private Set parts = new HashSet();\n""    \n""    public Set getParts() { return parts; }\n""    void setParts(Set parts) { this.parts = parts; }\n""    public String getSerialNumber() { return serialNumber; }\n""    void setSerialNumber(String sn) { serialNumber = sn; }\n""}]]>"msgstr ""#. Tag: para#: collection_mapping.xml:17#, no-c-formatmsgid """The actual interface might be <literal>java.util.Set</literal>, ""<literal>java.util.Collection</literal>, <literal>java.util.List</literal>, ""<literal>java.util.Map</literal>, <literal>java.util.SortedSet</literal>, ""<literal>java.util.SortedMap</literal> or ... anything you like! (Where ""\"anything you like\" means you will have to write an implementation of ""<literal>org.hibernate.usertype.UserCollectionType</literal>.)"msgstr """实际的接口可能是<literal>java.util.Set</literal>, <literal>java.util.""Collection</literal>, <literal>java.util.List</literal>, <literal>java.util.""Map</literal>, <literal>java.util.SortedSet</literal>, <literal>java.util.""SortedMap</literal> 或者...任何你喜欢的类型!(\"任何你喜欢的类型\" 代表你需要""编写 <literal>org.hibernate.usertype.UserCollectionType</literal>的实现.)"#. Tag: para#: collection_mapping.xml:26#, no-c-formatmsgid """Notice how we initialized the instance variable with an instance of ""<literal>HashSet</literal>. This is the best way to initialize collection ""valued properties of newly instantiated (non-persistent) instances. When you ""make the instance persistent - by calling <literal>persist()</literal>, for ""example - Hibernate will actually replace the <literal>HashSet</literal> ""with an instance of Hibernate's own implementation of <literal>Set</""literal>. Watch out for errors like this:"msgstr """注意我们是如何用一个<literal>HashSet</literal>实例来初始化实例变量的.这是用于""初始化新创建(尚未持久化)的类实例中集合值属性的最佳方法。当你持久化这个实例时""——比如通过调用<literal>persist()</literal>——Hibernate 会自动把""<literal>HashSet</literal>替换为Hibernate自己的<literal>Set</literal>实现。观""察下面的错误:"#. Tag: programlisting#: collection_mapping.xml:36#, no-c-formatmsgid """<![CDATA[Cat cat = new DomesticCat();\n""Cat kitten = new DomesticCat();\n""....\n""Set kittens = new HashSet();\n""kittens.add(kitten);\n""cat.setKittens(kittens);\n""session.persist(cat);\n""kittens = cat.getKittens(); // Okay, kittens collection is a Set\n""(HashSet) cat.getKittens(); // Error!]]>"msgstr ""#. Tag: para#: collection_mapping.xml:38#, no-c-formatmsgid """The persistent collections injected by Hibernate behave like ""<literal>HashMap</literal>, <literal>HashSet</literal>, <literal>TreeMap</""literal>, <literal>TreeSet</literal> or <literal>ArrayList</literal>, ""depending upon the interface type."msgstr """根据不同的接口类型,被Hibernate注射的持久化集合类的表现类似<literal>HashMap</""literal>, <literal>HashSet</literal>, <literal>TreeMap</literal>, ""<literal>TreeSet</literal> or <literal>ArrayList</literal>。"#. Tag: para#: collection_mapping.xml:45#, no-c-formatmsgid """Collections instances have the usual behavior of value types. They are ""automatically persisted when referenced by a persistent object and ""automatically deleted when unreferenced. If a collection is passed from one ""persistent object to another, its elements might be moved from one table to ""another. Two entities may not share a reference to the same collection ""instance. Due to the underlying relational model, collection-valued ""properties do not support null value semantics; Hibernate does not ""distinguish between a null collection reference and an empty collection."msgstr """集合类实例具有值类型的通常行为。当被持久化对象引用后,他们会自动被持久化,当""不再被引用后,自动被删除。假若实例被从一个持久化对象传递到另一个,它的元素可""能从一个表转移到另一个表。两个实体不能共享同一个集合类实例的引用。因为底层关""系数据库模型的原因,集合值属性无法支持空值语义;Hibernate对空的集合引用和空集""合不加区别。"#. Tag: para#: collection_mapping.xml:56#, no-c-formatmsgid """You shouldn't have to worry much about any of this. Use persistent ""collections the same way you use ordinary Java collections. Just make sure ""you understand the semantics of bidirectional associations (discussed later)."msgstr """你不需要过多的为此担心。就如同你平时使用普通的Java集合类一样来使用持久化集合""类。只是要确认你理解了双向关联的语义(后文讨论)。"#. Tag: title#: collection_mapping.xml:65#, no-c-formatmsgid "Collection mappings"msgstr "集合映射( Collection mappings )"#. Tag: para#: collection_mapping.xml:67#, no-c-formatmsgid """The Hibernate mapping element used for mapping a collection depends upon the ""type of the interface. For example, a <literal>&lt;set&gt;</literal> element ""is used for mapping properties of type <literal>Set</literal>."msgstr """用于映射集合类的Hibernate映射元素取决于接口的类型。比如, <literal>&lt;""set&gt;</literal> 元素用来映射<literal>Set</literal>类型的属性。"#. Tag: programlisting#: collection_mapping.xml:73#, no-c-formatmsgid """<![CDATA[<class name=\"Product\">\n""    <id name=\"serialNumber\" column=\"productSerialNumber\"/>\n""    <set name=\"parts\">\n""        <key column=\"productSerialNumber\" not-null=\"true\"/>\n""        <one-to-many class=\"Part\"/>\n""    </set>\n""</class>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:75#, no-c-formatmsgid """Apart from <literal>&lt;set&gt;</literal>, there is also <literal>&lt;""list&gt;</literal>, <literal>&lt;map&gt;</literal>, <literal>&lt;bag&gt;</""literal>, <literal>&lt;array&gt;</literal> and <literal>&lt;primitive-""array&gt;</literal> mapping elements. The <literal>&lt;map&gt;</literal> ""element is representative:"msgstr """除了<literal>&lt;set&gt;</literal>,还有<literal>&lt;list&gt;</literal>, ""<literal>&lt;map&gt;</literal>, <literal>&lt;bag&gt;</literal>, <literal>&lt;""array&gt;</literal> 和 <literal>&lt;primitive-array&gt;</literal> 映射元素。""<literal>&lt;map&gt;</literal>具有代表性:"#. Tag: programlisting#: collection_mapping.xml:100#, no-c-formatmsgid """<![CDATA[<map\n""    name=\"propertyName\"\n""    table=\"table_name\"\n""    schema=\"schema_name\"\n""    lazy=\"true|extra|false\"\n""    inverse=\"true|false\"\n""    cascade=\"all|none|save-update|delete|all-delete-orphan|delete-orphan\"\n""    sort=\"unsorted|natural|comparatorClass\"\n""    order-by=\"column_name asc|desc\"\n""    where=\"arbitrary sql where condition\"\n""    fetch=\"join|select|subselect\"\n""    batch-size=\"N\"\n""    access=\"field|property|ClassName\"\n""    optimistic-lock=\"true|false\"\n""    mutable=\"true|false\"\n""    node=\"element-name|.\"\n""    embed-xml=\"true|false\"\n"">\n""\n""    <key .... />\n""    <map-key .... />\n""    <element .... />\n""</map>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:103#, no-c-formatmsgid "<literal>name</literal> the collection property name"msgstr "<literal>name</literal> 集合属性的名称"#. Tag: para#: collection_mapping.xml:108#, no-c-formatmsgid """<literal>table</literal> (optional - defaults to property name) the name of ""the collection table (not used for one-to-many associations)"msgstr """<literal>table</literal> (可选——默认为属性的名称)这个集合表的名称(不能在一""对多的关联关系中使用)"#. Tag: para#: collection_mapping.xml:114#, no-c-formatmsgid """<literal>schema</literal> (optional) the name of a table schema to override ""the schema declared on the root element"msgstr """<literal>schema</literal> (可选) 表的schema的名称, 他将覆盖在根元素中定义的""schema"#. Tag: para#: collection_mapping.xml:120#, no-c-formatmsgid """<literal>lazy</literal> (optional - defaults to <literal>true</literal>) may ""be used to disable lazy fetching and specify that the association is always ""eagerly fetched, or to enable \"extra-lazy\" fetching where most operations ""do not initialize the collection (suitable for very large collections)"msgstr """<literal>lazy</literal> (可选--默认为true) 可以用来关闭延迟加载(false),指定""一直使用预先抓取,或者打开\"extra-lazy\" 抓取,此时大多数操作不会初始化集合类""(适用于非常大的集合)"#. Tag: para#: collection_mapping.xml:129#, no-c-formatmsgid """<literal>inverse</literal> (optional - defaults to <literal>false</literal>) ""mark this collection as the \"inverse\" end of a bidirectional association"msgstr """<literal>inverse</literal> (可选——默认为<literal>false</literal>) 标记这个集""合作为双向关联关系中的方向一端。"#. Tag: para#: collection_mapping.xml:135#, no-c-formatmsgid """<literal>cascade</literal> (optional - defaults to <literal>none</literal>) ""enable operations to cascade to child entities"msgstr """<literal>cascade</literal> (可选——默认为<literal>none</literal>) 让操作级联到""子实体"#. Tag: para#: collection_mapping.xml:141#, no-c-formatmsgid """<literal>sort</literal> (optional) specify a sorted collection with ""<literal>natural</literal> sort order, or a given comparator class"msgstr """<literal>sort</literal>(可选)指定集合的排序顺序, 其可以为自然的""(<literal>natural</literal>)或者给定一个用来比较的类。"#. Tag: para#: collection_mapping.xml:147#, no-c-formatmsgid """<literal>order-by</literal> (optional, JDK1.4 only) specify a table column ""(or columns) that define the iteration order of the <literal>Map</literal>, ""<literal>Set</literal> or bag, together with an optional <literal>asc</""literal> or <literal>desc</literal>"msgstr """<literal>order-by</literal> (可选, 仅用于jdk1.4) 指定表的字段(一个或几个)再加""上asc或者desc(可选), 定义Map,Set和Bag的迭代顺序"#. Tag: para#: collection_mapping.xml:154#, no-c-formatmsgid """<literal>where</literal> (optional) specify an arbitrary SQL <literal>WHERE</""literal> condition to be used when retrieving or removing the collection ""(useful if the collection should contain only a subset of the available data)"msgstr """<literal>where</literal> (可选) 指定任意的SQL where条件, 该条件将在重新载入或""者删除这个集合时使用(当集合中的数据仅仅是所有可用数据的一个子集时这个条件非常""有用)"#. Tag: para#: collection_mapping.xml:161#, no-c-formatmsgid """<literal>fetch</literal> (optional, defaults to <literal>select</literal>) ""Choose between outer-join fetching, fetching by sequential select, and ""fetching by sequential subselect."msgstr """<literal>fetch</literal> (可选, 默认为<literal>select</literal>) 用于在外连接""抓取、通过后续select抓取和通过后续subselect抓取之间选择。"#. Tag: para#: collection_mapping.xml:168#, no-c-formatmsgid """<literal>batch-size</literal> (optional, defaults to <literal>1</literal>) ""specify a \"batch size\" for lazily fetching instances of this collection."msgstr """<literal>batch-size</literal> (可选, 默认为<literal>1</literal>) 指定通过延迟""加载取得集合实例的批处理块大小(\"batch size\")。"#. Tag: para#: collection_mapping.xml:174#, no-c-formatmsgid """<literal>access</literal> (optional - defaults to <literal>property</"

⌨️ 快捷键说明

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