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

📄 association_mapping.pot

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 POT
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""POT-Creation-Date: 2007-10-19 10:28-0500\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"#: association_mapping.xml:6(title) msgid "Association Mappings"msgstr ""#: association_mapping.xml:9(title) msgid "Introduction"msgstr ""#: association_mapping.xml:11(para) msgid "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 ""#: association_mapping.xml:19(para) msgid "We'll classify associations by whether or not they map to an intervening join table, and by multiplicity."msgstr ""#: association_mapping.xml:24(para) msgid "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 ""#: association_mapping.xml:34(title) msgid "Unidirectional associations"msgstr ""#: association_mapping.xml:37(title) association_mapping.xml:195(title) msgid "many to one"msgstr ""#: association_mapping.xml:39(para) msgid "A <emphasis>unidirectional many-to-one association</emphasis> is the most common kind of unidirectional association."msgstr ""#: association_mapping.xml:66(title) association_mapping.xml:229(title) association_mapping.xml:373(title) association_mapping.xml:479(title) msgid "one to one"msgstr ""#: association_mapping.xml:68(para) msgid "A <emphasis>unidirectional one-to-one association on a foreign key</emphasis> is almost identical. The only difference is the column unique constraint."msgstr ""#: association_mapping.xml:93(para) msgid "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 ""#: association_mapping.xml:121(title) association_mapping.xml:161(title) msgid "one to many"msgstr ""#: association_mapping.xml:123(para) msgid "A <emphasis>unidirectional one-to-many association on a foreign key</emphasis> is a very unusual case, and is not really recommended."msgstr ""#: association_mapping.xml:149(para) msgid "We think it's better to use a join table for this kind of association."msgstr ""#: association_mapping.xml:158(title) msgid "Unidirectional associations with join tables"msgstr ""#: association_mapping.xml:163(para) msgid "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 ""#: association_mapping.xml:197(para) msgid "A <emphasis>unidirectional many-to-one association on a join table</emphasis> is quite common when the association is optional."msgstr ""#: association_mapping.xml:231(para) msgid "A <emphasis>unidirectional one-to-one association on a join table</emphasis> is extremely unusual, but possible."msgstr ""#: association_mapping.xml:265(title) association_mapping.xml:525(title) msgid "many to many"msgstr ""#: association_mapping.xml:267(para) msgid "Finally, we have a <emphasis>unidirectional many-to-many association</emphasis>."msgstr ""#: association_mapping.xml:298(title) msgid "Bidirectional associations"msgstr ""#: association_mapping.xml:301(title) association_mapping.xml:436(title) msgid "one to many / many to one"msgstr ""#: association_mapping.xml:303(para) msgid "A <emphasis>bidirectional many-to-one association</emphasis> is the most common kind of association. (This is the standard parent/child relationship.)"msgstr ""#: association_mapping.xml:333(para) msgid "If you use a <literal>List</literal> (or other indexed collection) you need to set the <literal>key</literal> column of the foreign key to <literal>not null</literal>, and let Hibernate manage the association from the collections side to maintain the index of each element (making the other side virtually inverse by setting <literal>update=\"false\"</literal> and <literal>insert=\"false\"</literal>):"msgstr ""#: association_mapping.xml:361(para) msgid "It is important that you define <literal>not-null=\"true\"</literal> on the <literal>&lt;key&gt;</literal> element of the collection mapping if the underlying foreign key column is <literal>NOT NULL</literal>. Don't only declare <literal>not-null=\"true\"</literal> on a possible nested <literal>&lt;column&gt;</literal> element, but on the <literal>&lt;key&gt;</literal> element."msgstr ""#: association_mapping.xml:375(para) msgid "A <emphasis>bidirectional one-to-one association on a foreign key</emphasis> is quite common."msgstr ""#: association_mapping.xml:402(para) msgid "A <emphasis>bidirectional one-to-one association on a primary key</emphasis> uses the special id generator."msgstr ""#: association_mapping.xml:433(title) msgid "Bidirectional associations with join tables"msgstr ""#: association_mapping.xml:438(para) msgid "A <emphasis>bidirectional one-to-many association on a join table</emphasis>. Note that the <literal>inverse=\"true\"</literal> can go on either end of the association, on the collection, or on the join."msgstr ""#: association_mapping.xml:481(para) msgid "A <emphasis>bidirectional one-to-one association on a join table</emphasis> is extremely unusual, but possible."msgstr ""#: association_mapping.xml:527(para) msgid "Finally, we have a <emphasis>bidirectional many-to-many association</emphasis>."msgstr ""#: association_mapping.xml:564(title) msgid "More complex association mappings"msgstr ""#: association_mapping.xml:566(para) msgid "More complex association joins are <emphasis>extremely</emphasis> rare. Hibernate makes it possible to handle more complex situations using SQL fragments embedded in the mapping document. For example, if a table with historical account information data defines <literal>accountNumber</literal>, <literal>effectiveEndDate</literal> and <literal>effectiveStartDate</literal>columns, mapped as follows:"msgstr ""#: association_mapping.xml:584(para) msgid "Then we can map an association to the <emphasis>current</emphasis> instance (the one with null <literal>effectiveEndDate</literal>) using:"msgstr ""#: association_mapping.xml:596(para) msgid "In a more complex example, imagine that the association between <literal>Employee</literal> and <literal>Organization</literal> is maintained in an <literal>Employment</literal> table full of historical employment data. Then an association to the employee's <emphasis>most recent</emphasis> employer (the one with the most recent <literal>startDate</literal>) might be mapped this way:"msgstr ""#: association_mapping.xml:617(para) msgid "You can get quite creative with this functionality, but it is usually more practical to handle these kinds of cases using HQL or a criteria query."msgstr ""#. Put one translator per line, in the form of NAME <EMAIL>, YEAR1, YEAR2.#: association_mapping.xml:0(None) msgid "translator-credits"msgstr ""

⌨️ 快捷键说明

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