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

📄 collection_mapping.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 5 页
字号:
"literal>): The strategy Hibernate should use for accessing the collection ""property value."msgstr """<literal>access</literal>(可选-默认为属性property):Hibernate取得集合属性值时""使用的策略"#. Tag: para#: collection_mapping.xml:180#, no-c-formatmsgid """<literal>optimistic-lock</literal> (optional - defaults to <literal>true</""literal>): Species that changes to the state of the collection results in ""increment of the owning entity's version. (For one to many associations, it ""is often reasonable to disable this setting.)"msgstr """<literal>乐观锁</literal> (可选 - 默认为 <literal>true</literal>): 对集合的状""态的改变会是否导致其所属的实体的版本增长。 (对一对多关联来说,关闭这个属性常""常是有理的)"#. Tag: para#: collection_mapping.xml:188#, no-c-formatmsgid """<literal>mutable</literal> (optional - defaults to <literal>true</literal>): ""A value of <literal>false</literal> specifies that the elements of the ""collection never change (a minor performance optimization in some cases)."msgstr """<literal>mutable(可变)</literal> (可选 - 默认为<literal>true</literal>): 若""值为<literal>false</literal>,表明集合中的元素不会改变(在某些情况下可以进行一""些小的性能优化)。"#. Tag: title#: collection_mapping.xml:198#, no-c-formatmsgid "Collection foreign keys"msgstr "集合外键(Collection foreign keys)"#. Tag: para#: collection_mapping.xml:200#, no-c-formatmsgid """Collection instances are distinguished in the database by the foreign key of ""the entity that owns the collection. This foreign key is referred to as the ""<emphasis>collection key column</emphasis> (or columns) of the collection ""table. The collection key column is mapped by the <literal>&lt;key&gt;</""literal> element."msgstr """集合实例在数据库中依靠持有集合的实体的外键加以辨别。此外键作为<emphasis>集合""关键字段(collection key column)</emphasis>(或多个字段)加以引用。集合关键""字段通过<literal>&lt;key&gt;</literal> 元素映射。"#. Tag: para#: collection_mapping.xml:208#, no-c-formatmsgid """There may be a nullability constraint on the foreign key column. For most ""collections, this is implied. For unidirectional one to many associations, ""the foreign key column is nullable by default, so you might need to specify ""<literal>not-null=\"true\"</literal>."msgstr """在外键字段上可能具有非空约束。对于大多数集合来说,这是隐含的。对单向一对多关""联来说,外键字段默认是可以为空的,因此你可能需要指明 <literal>not-null=\"true""\"</literal>。"#. Tag: programlisting#: collection_mapping.xml:215#, no-c-formatmsgid "<![CDATA[<key column=\"productSerialNumber\" not-null=\"true\"/>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:217#, no-c-formatmsgid """The foreign key constraint may use <literal>ON DELETE CASCADE</literal>."msgstr "外键约束可以使用<literal>ON DELETE CASCADE</literal>。"#. Tag: programlisting#: collection_mapping.xml:221#, no-c-formatmsgid "<![CDATA[<key column=\"productSerialNumber\" on-delete=\"cascade\"/>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:223#, no-c-formatmsgid """See the previous chapter for a full definition of the <literal>&lt;key&gt;</""literal> element."msgstr "对<literal>&lt;key&gt;</literal> 元素的完整定义,请参阅前面的章节。"#. Tag: title#: collection_mapping.xml:231#, no-c-formatmsgid "Collection elements"msgstr "集合元素(Collection elements)"#. Tag: para#: collection_mapping.xml:233#, no-c-formatmsgid """Collections may contain almost any other Hibernate type, including all basic ""types, custom types, components, and of course, references to other ""entities. This is an important distinction: an object in a collection might ""be handled with \"value\" semantics (its life cycle fully depends on the ""collection owner) or it might be a reference to another entity, with its own ""life cycle. In the latter case, only the \"link\" between the two objects is ""considered to be state held by the collection."msgstr """集合几乎可以包含任何其他的Hibernate类型,包括所有的基本类型、自定义类型、组""件,当然还有对其他实体的引用。存在一个重要的区别:位于集合中的对象可能是根""据“值”语义来操作(其声明周期完全依赖于集合持有者),或者它可能是指向另一个实""体的引用,具有其自己的生命周期。在后者的情况下,被作为集合持有的状态考虑的,""只有两个对象之间的“连接”。"#. Tag: para#: collection_mapping.xml:242#, no-c-formatmsgid """The contained type is referred to as the <emphasis>collection element type</""emphasis>. Collection elements are mapped by <literal>&lt;element&gt;</""literal> or <literal>&lt;composite-element&gt;</literal>, or in the case of ""entity references, with <literal>&lt;one-to-many&gt;</literal> or ""<literal>&lt;many-to-many&gt;</literal>. The first two map elements with ""value semantics, the next two are used to map entity associations."msgstr """被包容的类型被称为<emphasis>集合元素类型(collection element type)</""emphasis>。集合元素通过<literal>&lt;element&gt;</literal>或<literal>&lt;""composite-element&gt;</literal>映射,或在其是实体引用的时候,通过""<literal>&lt;one-to-many&gt;</literal> 或<literal>&lt;many-to-many&gt;</""literal>映射。前两种用于使用值语义映射元素,后两种用于映射实体关联。"#. Tag: title#: collection_mapping.xml:254#, no-c-formatmsgid "Indexed collections"msgstr "索引集合类(Indexed collections)"#. Tag: para#: collection_mapping.xml:256#, no-c-formatmsgid """All collection mappings, except those with set and bag semantics, need an ""<emphasis>index column</emphasis> in the collection table - a column that ""maps to an array index, or <literal>List</literal> index, or <literal>Map</""literal> key. The index of a <literal>Map</literal> may be of any basic ""type, mapped with <literal>&lt;map-key&gt;</literal>, it may be an entity ""reference mapped with <literal>&lt;map-key-many-to-many&gt;</literal>, or it ""may be a composite type, mapped with <literal>&lt;composite-map-key&gt;</""literal>. The index of an array or list is always of type <literal>integer</""literal> and is mapped using the <literal>&lt;list-index&gt;</literal> ""element. The mapped column contains sequential integers (numbered from zero, ""by default)."msgstr """所有的集合映射,除了set和bag语义的以外,都需要指定一个集合表的<emphasis>索引""字段(index column)</emphasis>——用于对应到数组索引,或者<literal>List</""literal>的索引,或者<literal>Map</literal>的关键字。通过<literal>&lt;map-""key&gt;</literal>,<literal>Map</literal> 的索引可以是任何基础类型;若通过""<literal>&lt;map-key-many-to-many&gt;</literal>,它也可以是一个实体引用;若通""过<literal>&lt;composite-map-key&gt;</literal>,它还可以是一个组合类型。数组""或列表的索引必须是<literal>integer</literal>类型,并且使用 <literal>&lt;list-""index&gt;</literal>元素定义映射。被映射的字段包含有顺序排列的整数(默认从0开""始)。"#. Tag: sect2#: collection_mapping.xml:267#, no-c-formatmsgid """<programlistingco> <areaspec> <area id=\"index1\" coords=\"2 45\"/> <area id=""\"index2\" coords=\"3 45\"/> </areaspec> <programlisting><![CDATA[<list-""index \n""        column=\"column_name\"\n""        base=\"0|1|...\"/>]]></programlisting> <calloutlist> <callout ""arearefs=\"index1\"> <para> <literal>column_name</literal> (required): The ""name of the column holding the collection index values. </para> </callout> ""<callout arearefs=\"index1\"> <para> <literal>base</literal> (optional, ""defaults to <literal>0</literal>): The value of the index column that ""corresponds to the first element of the list or array. </para> </callout> </""calloutlist> </programlistingco> <programlistingco> <areaspec> <area id=""\"mapkey1\" coords=\"2 45\"/> <area id=\"mapkey2\" coords=\"3 45\"/> <area ""id=\"mapkey3\" coords=\"4 45\"/> </areaspec> <programlisting><![CDATA[<map-""key \n""        column=\"column_name\"\n""        formula=\"any SQL expression\"\n""        type=\"type_name\"\n""        node=\"@attribute-name\"\n""        length=\"N\"/>]]></programlisting> <calloutlist> <callout arearefs=""\"mapkey1\"> <para> <literal>column</literal> (optional): The name of the ""column holding the collection index values. </para> </callout> <callout ""arearefs=\"mapkey2\"> <para> <literal>formula</literal> (optional): A SQL ""formula used to evaluate the key of the map. </para> </callout> <callout ""arearefs=\"mapkey3\"> <para> <literal>type</literal> (reguired): The type of ""the map keys. </para> </callout> </calloutlist> </programlistingco> ""<programlistingco> <areaspec> <area id=\"indexmanytomany1\" coords=\"2 45\"/""> <area id=\"indexmanytomany2\" coords=\"3 45\"/> <area id=\"indexmanytomany3""\" coords=\"3 45\"/> </areaspec> <programlisting><![CDATA[<map-key-many-to-""many\n""        column=\"column_name\"\n""        formula=\"any SQL expression\"\n""        class=\"ClassName\"\n""/>]]></programlisting> <calloutlist> <callout arearefs=\"indexmanytomany1\"> ""<para> <literal>column</literal> (optional): The name of the foreign key ""column for the collection index values. </para> </callout> <callout arearefs=""\"indexmanytomany2\"> <para> <literal>formula</literal> (optional): A SQL ""formula used to evaluate the foreign key of the map key. </para> </callout> ""<callout arearefs=\"indexmanytomany3\"> <para> <literal>class</literal> ""(required): The entity class used as the map key. </para> </callout> </""calloutlist> </programlistingco>"msgstr ""#. Tag: para#: collection_mapping.xml:348#, no-c-formatmsgid """If your table doesn't have an index column, and you still wish to use ""<literal>List</literal> as the property type, you should map the property as ""a Hibernate <emphasis>&lt;bag&gt;</emphasis>. A bag does not retain its ""order when it is retrieved from the database, but it may be optionally ""sorted or ordered."msgstr """值集合于多对多关联(Collections of values and many-to-many associations)"#. Tag: para#: collection_mapping.xml:357#, no-c-formatmsgid """There are quite a range of mappings that can be generated for collections, ""covering many common relational models. We suggest you experiment with the ""schema generation tool to get a feeling for how various mapping declarations ""translate to database tables."msgstr """任何值集合或者多对多关联需要专用的具有一个或多个外键字段的""<emphasis>collection table</emphasis>、一个或多个<emphasis>collection ""element column</emphasis>,以及还可能有一个或多个索引字段。"#. Tag: title#: collection_mapping.xml:364#, no-c-formatmsgid "Collections of values and many-to-many associations"msgstr "对于一个值集合, 我们使用<literal>&lt;element&gt;</literal>标签。"#. Tag: para#: collection_mapping.xml:366#, no-c-formatmsgid """Any collection of values or many-to-many association requires a dedicated ""<emphasis>collection table</emphasis> with a foreign key column or columns, ""<emphasis>collection element column</emphasis> or columns and possibly an ""index column or columns."msgstr "<literal>column</literal>(可选):保存集合元素值的字段名。"#. Tag: para#: collection_mapping.xml:373#, no-c-formatmsgid """For a collection of values, we use the <literal>&lt;element&gt;</literal> ""tag."msgstr "<literal>formula</literal> (可选): 用于计算元素的SQL公式"#. Tag: sect2#: collection_mapping.xml:375#, no-c-formatmsgid """<programlistingco> <areaspec> <area id=\"element1b\" coords=\"2 50\"/> <area ""id=\"element2b\" coords=\"3 50\"/> <area id=\"element3b\" coords=\"4 50\"/> ""</areaspec> <programlisting><![CDATA[<element\n""        column=\"column_name\"\n""        formula=\"any SQL expression\"\n""        type=\"typename\"\n""        length=\"L\"\n""        precision=\"P\"\n""        scale=\"S\"\n""        not-null=\"true|false\"\n""        unique=\"true|false\"\n""        node=\"element-name\"\n""/>]]></programlisting> <calloutlist> <callout arearefs=\"element1b\"> <para> ""<literal>column</literal> (optional): The name of the column holding the ""collection element values. </para> </callout> <callout arearefs=\"element2b""\"> <para> <literal>formula</literal> (optional): An SQL formula used to ""evaluate the element. </para> </callout> <callout arearefs=\"element3b\"> ""<para> <literal>type</literal> (required): The type of the collection ""element. </para> </callout> </calloutlist> </programlistingco> <para> A ""<emphasis>many-to-many association</emphasis> is specified using the ""<literal>&lt;many-to-many&gt;</literal> element. </para> <programlistingco> ""<areaspec> <area id=\"manytomany1\" coords=\"2 60\"/> <area id=\"manytomany2""\" coords=\"3 60\"/> <area id=\"manytomany3\" coords=\"4 60\"/> <area id=""\"manytomany4\" coords=\"5 60\"/> <area id=\"manytomany5\" coords=\"6 60\"/> ""<area id=\"manytomany6\" coords=\"7 60\"/> <area id=\"manytomany7\" coords=""\"8 60\"/> <area id=\"manytomany8\" coords=\"9 60\"/> </areaspec> ""<programlisting><![CDATA[<many-to-many\n""        column=\"column_name\"\n""        formula=\"any SQL expression\"\n""        class=\"ClassName\"\n""        fetch=\"select|join\"\n""        unique=\"true|false\"\n""        not-found=\"ignore|exception\"\n""        entity-name=\"EntityName\"\n""        property-ref=\"propertyNameFromAssociatedClass\"\n""        node=\"element-name\"\n""        embed-xml=\"true|false\"\n""    />]]></programlisting> <calloutlist> <callout arearefs=\"manytomany1\"> ""<para> <literal>column</literal> (optional): The name of the element foreign ""key column. </para> </callout> <callout arearefs=\"manytomany2\"> <para> ""<literal>formula</literal> (optional): An SQL formula used to evaluate the ""element foreign key value. </para> </callout> <callout arearefs=\"manytomany3""\"> <para> <literal>class</literal> (required): The name of the associated ""class. </para> </callout> <callout arearefs=\"manytomany4\"> <para> ""<literal>fetch</literal> (optional - defaults to <literal>join</literal>): ""enables outer-join or sequential select fetching for this association. This ""is a special case; for full eager fetching (in a single <literal>SELECT</""literal>) of an entity and its many-to-many relationships to other entities, ""you would enable <literal>join</literal> fetching not only of the collection ""itself, but also with this attribute on the <literal>&lt;many-to-many&gt;</""literal> nested element. </para> </callout> <callout arearefs=\"manytomany5""\"> <para> <literal>unique</literal> (optional): Enable the DDL generation ""of a unique constraint for the foreign-key column. This makes the ""association multiplicity effectively one to many. </para> </callout> ""<callout arearefs=\"manytomany6\"> <para> <literal>not-found</literal> ""(optional - defaults to <literal>exception</literal>): Specifies how foreign ""keys that reference missing rows will be handled: <literal>ignore</literal> ""will treat a missing row as a null association. </para> </callout> <callout ""arearefs=\"manytomany7\"> <para> <literal>entity-name</literal> (optional): ""The entity name of the associated class, as an alternative to ""<literal>class</literal>. </para> </callout> <callout arearefs=\"manytomany8""\"> <para> <literal>property-ref</literal>: (optional) The name of a ""property of the associated class that is joined to this foreign key. If not ""specified, the primary key of the associated class is used. </para> </""callout> </calloutlist> </programlistingco>"msgstr ""#. Tag: para#: collection_mapping.xml:480#, no-c-formatmsgid "Some examples, first, a set of strings:"msgstr """包含一组整数的bag(还设置了<literal>order-by</literal>参数指定了迭代的顺序):"#. Tag: programlisting#: collection_mapping.xml:484#, no-c-formatmsgid """<![CDATA[<set name=\"names\" table=\"person_names\">\n""    <key column=\"person_id\"/>\n""    <element column=\"person_name\" type=\"string\"/>\n"

⌨️ 快捷键说明

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