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

📄 association_mapping.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 2 页
字号:
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#: association_mapping.xml:6#, no-c-formatmsgid "Association Mappings"msgstr "关联关系映射"#. Tag: title#: association_mapping.xml:9#, no-c-formatmsgid "Introduction"msgstr "介绍"#. Tag: para#: association_mapping.xml:11#, no-c-formatmsgid """Association mappings are the often most difficult thing to get right. In ""this section we'll go through the canonical cases one by one, starting with ""unidirectional mappings, and then considering the bidirectional cases. We'll ""use <literal>Person</literal> and <literal>Address</literal> in all the ""examples."msgstr """关联关系映射通常情况是最难配置正确的。在这个部分中,我们从单向关系映射开始,""然后考虑双向关系映射,由浅至深讲述一遍典型的案例。在所有的例子中,我们都使用 ""<literal>Person</literal>和<literal>Address</literal>。"#. Tag: para#: association_mapping.xml:19#, no-c-formatmsgid """We'll classify associations by whether or not they map to an intervening ""join table, and by multiplicity."msgstr "我们根据映射关系是否涉及连接表以及多样性来划分关联类型。"#. Tag: para#: association_mapping.xml:24#, no-c-formatmsgid """Nullable foreign keys are not considered good practice in traditional data ""modelling, so all our examples use not null foreign keys. This is not a ""requirement of Hibernate, and the mappings will all work if you drop the ""nullability constraints."msgstr """在传统的数据建模中,允许为Null值的外键被认为是一种不好的实践,因此我们所有的""例子中都使用不允许为Null的外键。这并不是Hibernate的要求,即使你删除掉不允许为""Null的约束,Hibernate映射一样可以工作的很好。"#. Tag: title#: association_mapping.xml:34#, no-c-formatmsgid "Unidirectional associations"msgstr "单向关联(Unidirectional associations)"#. Tag: title#: association_mapping.xml:37 association_mapping.xml:108#, fuzzy, no-c-formatmsgid "many to one"msgstr """#-#-#-#-#  - (PACKAGE VERSION)  #-#-#-#-#\n""多对一(many to one)\n""#-#-#-#-#  - (PACKAGE VERSION)  #-#-#-#-#\n""多对一(many to one)"#. Tag: para#: association_mapping.xml:39#, no-c-formatmsgid """A <emphasis>unidirectional many-to-one association</emphasis> is the most ""common kind of unidirectional association."msgstr "<emphasis>单向many-to-one关联</emphasis>是最常见的单向关联关系。"#. Tag: programlisting#: association_mapping.xml:44#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <many-to-one name=\"address\" \n""        column=\"addressId\"\n""        not-null=\"true\"/>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:45 association_mapping.xml:161#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key, addressId bigint ""not null )\n""create table Address ( addressId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: title#: association_mapping.xml:50 association_mapping.xml:121#: association_mapping.xml:185 association_mapping.xml:225#, no-c-formatmsgid "one to one"msgstr "一对一(one to one)"#. Tag: para#: association_mapping.xml:52#, no-c-formatmsgid """A <emphasis>unidirectional one-to-one association on a foreign key</""emphasis> is almost identical. The only difference is the column unique ""constraint."msgstr """<emphasis>基于外键关联的单向一对一关联</emphasis>和<emphasis>单向多对一关联</""emphasis>几乎是一样的。唯一的不同就是单向一对一关联中的外键字段具有唯一性约""束。"#. Tag: programlisting#: association_mapping.xml:57#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <many-to-one name=\"address\" \n""        column=\"addressId\" \n""        unique=\"true\"\n""        not-null=\"true\"/>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:58 association_mapping.xml:193#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key, addressId bigint ""not null unique )\n""create table Address ( addressId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: para#: association_mapping.xml:60#, no-c-formatmsgid """A <emphasis>unidirectional one-to-one association on a primary key</""emphasis> usually uses a special id generator. (Notice that we've reversed ""the direction of the association in this example.)"msgstr """<emphasis>基于主键关联的单向一对一关联</emphasis>通常使用一个特定的id生成器。""(请注意,在这个例子中我们掉换了关联的方向。)"#. Tag: programlisting#: association_mapping.xml:66#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"foreign\">\n""            <param name=\"property\">person</param>\n""        </generator>\n""    </id>\n""    <one-to-one name=\"person\" constrained=\"true\"/>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:67 association_mapping.xml:201#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key )\n""create table Address ( personId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: title#: association_mapping.xml:72 association_mapping.xml:94#, fuzzy, no-c-formatmsgid "one to many"msgstr """#-#-#-#-#  - (PACKAGE VERSION)  #-#-#-#-#\n""一对多(one to many)\n""#-#-#-#-#  - (PACKAGE VERSION)  #-#-#-#-#\n""一对多(one to many)"#. Tag: para#: association_mapping.xml:74#, no-c-formatmsgid """A <emphasis>unidirectional one-to-many association on a foreign key</""emphasis> is a very unusual case, and is not really recommended."msgstr """<emphasis>基于外键关联的单向一对多关联</emphasis>是一种很少见的情况,并不推荐""使用。"#. Tag: programlisting#: association_mapping.xml:79#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <set name=\"addresses\">\n""        <key column=\"personId\" \n""            not-null=\"true\"/>\n""        <one-to-many class=\"Address\"/>\n""    </set>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:80#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key )\n""create table Address ( addressId bigint not null primary key, personId ""bigint not null )\n""        ]]>"msgstr ""#. Tag: para#: association_mapping.xml:82#, no-c-formatmsgid "We think it's better to use a join table for this kind of association."msgstr "我们认为对于这种关联关系最好使用连接表。"#. Tag: title#: association_mapping.xml:91#, no-c-formatmsgid "Unidirectional associations with join tables"msgstr "使用连接表的单向关联(Unidirectional associations with join tables)"#. Tag: para#: association_mapping.xml:96#, no-c-formatmsgid """A <emphasis>unidirectional one-to-many association on a join table</""emphasis> is much preferred. Notice that by specifying <literal>unique=\"true""\"</literal>, we have changed the multiplicity from many-to-many to one-to-""many."msgstr """<emphasis>基于连接表的单向一对多关联</emphasis> 应该优先被采用。请注意,通过""指定<literal>unique=\"true\"</literal>,我们可以把多样性从多对多改变为一对""多。"#. Tag: programlisting#: association_mapping.xml:102#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <set name=\"addresses\" table=\"PersonAddress\">\n""        <key column=\"personId\"/>\n""        <many-to-many column=\"addressId\"\n""            unique=\"true\"\n""            class=\"Address\"/>\n""    </set>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:103#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key )\n""create table PersonAddress ( personId not null, addressId bigint not null ""primary key )\n""create table Address ( addressId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: para#: association_mapping.xml:110#, no-c-formatmsgid """A <emphasis>unidirectional many-to-one association on a join table</""emphasis> is quite common when the association is optional."msgstr """<emphasis>基于连接表的单向多对一关联</emphasis>在关联关系可选的情况下应用也很""普遍。"#. Tag: programlisting#: association_mapping.xml:115#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <join table=\"PersonAddress\" \n""        optional=\"true\">\n""        <key column=\"personId\" unique=\"true\"/>\n""        <many-to-one name=\"address\"\n""            column=\"addressId\" \n""            not-null=\"true\"/>\n""    </join>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:116#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key )\n""create table PersonAddress ( personId bigint not null primary key, addressId ""bigint not null )\n""create table Address ( addressId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: para#: association_mapping.xml:123#, no-c-formatmsgid """A <emphasis>unidirectional one-to-one association on a join table</emphasis> ""is extremely unusual, but possible."msgstr """<emphasis>基于连接表的单向一对一关联</emphasis>非常少见,但也是可行的。"#. Tag: programlisting#: association_mapping.xml:128#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <join table=\"PersonAddress\" \n""        optional=\"true\">\n""        <key column=\"personId\" \n""            unique=\"true\"/>\n""        <many-to-one name=\"address\"\n""            column=\"addressId\" \n""            not-null=\"true\"\n""            unique=\"true\"/>\n""    </join>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:129 association_mapping.xml:233#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key )\n""create table PersonAddress ( personId bigint not null primary key, addressId ""bigint not null unique )\n""create table Address ( addressId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: title#: association_mapping.xml:134 association_mapping.xml:238#, no-c-formatmsgid "many to many"msgstr "多对多(many to many)"#. Tag: para#: association_mapping.xml:136#, no-c-formatmsgid """Finally, we have a <emphasis>unidirectional many-to-many association</""emphasis>."msgstr "最后,还有 <emphasis>单向多对多关联</emphasis>."#. Tag: programlisting#: association_mapping.xml:140#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <set name=\"addresses\" table=\"PersonAddress\">\n""        <key column=\"personId\"/>\n"

⌨️ 快捷键说明

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