📄 component_mapping.po
字号:
msgid """<![CDATA[<class name=\"eg.Order\" .... >\n"" ....\n"" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"" <key column=\"order_id\">\n"" <composite-element class=\"eg.Purchase\">\n"" <property name=\"purchaseDate\"/>\n"" <property name=\"price\"/>\n"" <property name=\"quantity\"/>\n"" <many-to-one name=\"item\" class=\"eg.Item\"/> <!-- class ""attribute is optional -->\n"" </composite-element>\n"" </set>\n""</class>]]>"msgstr ""#. Tag: para#: component_mapping.xml:125#, no-c-formatmsgid """Of course, there can't be a reference to the purchae on the other side, for ""bidirectional association navigation. Remember that components are value ""types and don't allow shared references. A single <literal>Purchase</""literal> can be in the set of an <literal>Order</literal>, but it can't be ""referenced by the <literal>Item</literal> at the same time."msgstr """当然,当你定义Item时,你无法引用这些purchase,因此你无法实现双向关联查询。记""住组件是值类型,并且不允许共享引用。某一个特定的<literal>Purchase</literal> ""可以放在<literal>Order</literal>的集合中,但它不能同时被<literal>Item</""literal>所引用。"#. Tag: para#: component_mapping.xml:133#, no-c-formatmsgid "Even ternary (or quaternary, etc) associations are possible:"msgstr "其实组合元素的这个用法可以扩展到三重或多重关联:"#. Tag: programlisting#: component_mapping.xml:135#, no-c-formatmsgid """<![CDATA[<class name=\"eg.Order\" .... >\n"" ....\n"" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"" <key column=\"order_id\">\n"" <composite-element class=\"eg.OrderLine\">\n"" <many-to-one name=\"purchaseDetails class=\"eg.Purchase\"/>\n"" <many-to-one name=\"item\" class=\"eg.Item\"/>\n"" </composite-element>\n"" </set>\n""</class>]]>"msgstr ""#. Tag: para#: component_mapping.xml:137#, no-c-formatmsgid """Composite elements may appear in queries using the same syntax as ""associations to other entities."msgstr "在查询中,表达组合元素的语法和关联到其他实体的语法是一样的。"#. Tag: title#: component_mapping.xml:145#, no-c-formatmsgid "Components as Map indices"msgstr "组件作为Map的索引(Components as Map indices )"#. Tag: para#: component_mapping.xml:147#, no-c-formatmsgid """The <literal><composite-map-key></literal> element lets you map a ""component class as the key of a <literal>Map</literal>. Make sure you ""override <literal>hashCode()</literal> and <literal>equals()</literal> ""correctly on the component class."msgstr """<literal><composite-map-key></literal>元素允许你映射一个组件类作为一个""<literal>Map</literal>的key,前提是你必须正确的在这个类中重写了""<literal>hashCode()</literal> 和 <literal>equals()</literal>方法。"#. Tag: title#: component_mapping.xml:156#, no-c-formatmsgid "Components as composite identifiers"msgstr "组件作为联合标识符(Components as composite identifiers)"#. Tag: para#: component_mapping.xml:158#, no-c-formatmsgid """You may use a component as an identifier of an entity class. Your component ""class must satisfy certain requirements:"msgstr """你可以使用一个组件作为一个实体类的标识符。 你的组件类必须满足以下要求:"#. Tag: para#: component_mapping.xml:165#, no-c-formatmsgid "It must implement <literal>java.io.Serializable</literal>."msgstr "它必须实现<literal>java.io.Serializable</literal>接口"#. Tag: para#: component_mapping.xml:170#, no-c-formatmsgid """It must re-implement <literal>equals()</literal> and <literal>hashCode()</""literal>, consistently with the database's notion of composite key equality."msgstr """它必须重新实现<literal>equals()</literal>和<literal>hashCode()</literal>方""法, 始终和组合关键字在数据库中的概念保持一致"#. Tag: emphasis#: component_mapping.xml:179#, no-c-formatmsgid """Note: in Hibernate3, the second requirement is not an absolutely hard ""requirement of Hibernate. But do it anyway."msgstr """注意:在Hibernate3中,第二个要求并非是Hibernate强制必须的。但最好这样做。"#. Tag: para#: component_mapping.xml:183#, no-c-formatmsgid """You can't use an <literal>IdentifierGenerator</literal> to generate ""composite keys. Instead the application must assign its own identifiers."msgstr """你不能使用一个<literal>IdentifierGenerator</literal>产生组合关键字。一个应用""程序必须分配它自己的标识符。"#. Tag: para#: component_mapping.xml:188#, no-c-formatmsgid """Use the <literal><composite-id></literal> tag (with nested ""<literal><key-property></literal> elements) in place of the usual ""<literal><id></literal> declaration. For example, the ""<literal>OrderLine</literal> class has a primary key that depends upon the ""(composite) primary key of <literal>Order</literal>."msgstr """使用<literal><composite-id></literal> 标签(并且内嵌<literal><key-""property></literal>元素)代替通常的<literal><id></literal>标签。比如,""<literal>OrderLine</literal>类具有一个主键,这个主键依赖于<literal>Order</""literal>的(联合)主键。"#. Tag: programlisting#: component_mapping.xml:196#, no-c-formatmsgid """<![CDATA[<class name=\"OrderLine\">\n"" \n"" <composite-id name=\"id\" class=\"OrderLineId\">\n"" <key-property name=\"lineId\"/>\n"" <key-property name=\"orderId\"/>\n"" <key-property name=\"customerId\"/>\n"" </composite-id>\n"" \n"" <property name=\"name\"/>\n"" \n"" <many-to-one name=\"order\" class=\"Order\"\n"" insert=\"false\" update=\"false\">\n"" <column name=\"orderId\"/>\n"" <column name=\"customerId\"/>\n"" </many-to-one>\n"" ....\n"" \n""</class>]]>"msgstr ""#. Tag: para#: component_mapping.xml:198#, no-c-formatmsgid """Now, any foreign keys referencing the <literal>OrderLine</literal> table are ""also composite. You must declare this in your mappings for other classes. An ""association to <literal>OrderLine</literal> would be mapped like this:"msgstr """现在,任何指向<literal>OrderLine</literal>的外键都是复合的。在你的映射文件""中,必须为其他类也这样声明。例如,一个指向<literal>OrderLine</literal>的关联""可能被这样映射:"#. Tag: programlisting#: component_mapping.xml:204#, no-c-formatmsgid """<![CDATA[<many-to-one name=\"orderLine\" class=\"OrderLine\">\n""<!-- the \"class\" attribute is optional, as usual -->\n"" <column name=\"lineId\"/>\n"" <column name=\"orderId\"/>\n"" <column name=\"customerId\"/>\n""</many-to-one>]]>"msgstr ""#. Tag: para#: component_mapping.xml:206#, no-c-formatmsgid """(Note that the <literal><column></literal> tag is an alternative to ""the <literal>column</literal> attribute everywhere.)"msgstr """(注意在各个地方<literal><column></literal>标签都是<literal>column</""literal>属性的替代写法。)"#. Tag: para#: component_mapping.xml:211#, no-c-formatmsgid """A <literal>many-to-many</literal> association to <literal>OrderLine</""literal> also uses the composite foreign key:"msgstr """指向<literal>OrderLine</literal>的<literal>多对多</literal>关联也使用联合外""键:"#. Tag: programlisting#: component_mapping.xml:216#, no-c-formatmsgid """<![CDATA[<set name=\"undeliveredOrderLines\">\n"" <key column name=\"warehouseId\"/>\n"" <many-to-many class=\"OrderLine\">\n"" <column name=\"lineId\"/>\n"" <column name=\"orderId\"/>\n"" <column name=\"customerId\"/>\n"" </many-to-many>\n""</set>]]>"msgstr ""#. Tag: para#: component_mapping.xml:218#, no-c-formatmsgid """The collection of <literal>OrderLine</literal>s in <literal>Order</literal> ""would use:"msgstr """在<literal>Order</literal>中,<literal>OrderLine</literal>的集合则是这样:"#. Tag: programlisting#: component_mapping.xml:223#, no-c-formatmsgid """<![CDATA[<set name=\"orderLines\" inverse=\"true\">\n"" <key>\n"" <column name=\"orderId\"/>\n"" <column name=\"customerId\"/>\n"" </key>\n"" <one-to-many class=\"OrderLine\"/>\n""</set>]]>"msgstr ""#. Tag: para#: component_mapping.xml:225#, no-c-formatmsgid """(The <literal><one-to-many></literal> element, as usual, declares no ""columns.)"msgstr "(与通常一样,<literal><one-to-many></literal>元素不声明任何列.)"#. Tag: para#: component_mapping.xml:229#, no-c-formatmsgid """If <literal>OrderLine</literal> itself owns a collection, it also has a ""composite foreign key."msgstr "假若<literal>OrderLine</literal>本身拥有一个集合,它也具有组合外键。"#. Tag: programlisting#: component_mapping.xml:234#, no-c-formatmsgid """<![CDATA[<class name=\"OrderLine\">\n"" ....\n"" ....\n"" <list name=\"deliveryAttempts\">\n"" <key> <!-- a collection inherits the composite key type -->\n"" <column name=\"lineId\"/>\n"" <column name=\"orderId\"/>\n"" <column name=\"customerId\"/>\n"" </key>\n"" <list-index column=\"attemptId\" base=\"1\"/>\n"" <composite-element class=\"DeliveryAttempt\">\n"" ...\n"" </composite-element>\n"" </set>\n""</class>]]>"msgstr ""#. Tag: title#: component_mapping.xml:239#, no-c-formatmsgid "Dynamic components"msgstr "动态组件 (Dynamic components)"#. Tag: para#: component_mapping.xml:241#, no-c-formatmsgid "You may even map a property of type <literal>Map</literal>:"msgstr "你甚至可以映射<literal>Map</literal>类型的属性:"#. Tag: programlisting#: component_mapping.xml:245#, no-c-formatmsgid """<![CDATA[<dynamic-component name=\"userAttributes\">\n"" <property name=\"foo\" column=\"FOO\" type=\"string\"/>\n"" <property name=\"bar\" column=\"BAR\" type=\"integer\"/>\n"" <many-to-one name=\"baz\" class=\"Baz\" column=\"BAZ_ID\"/>\n""</dynamic-component>]]>"msgstr ""#. Tag: para#: component_mapping.xml:247#, no-c-formatmsgid """The semantics of a <literal><dynamic-component></literal> mapping are ""identical to <literal><component></literal>. The advantage of this ""kind of mapping is the ability to determine the actual properties of the ""bean at deployment time, just by editing the mapping document. Runtime ""manipulation of the mapping document is also possible, using a DOM parser. ""Even better, you can access (and change) Hibernate's configuration-time ""metamodel via the <literal>Configuration</literal> object."msgstr """从<literal><dynamic-component></literal>映射的语义上来讲,它和""<literal><component></literal>是相同的。 这种映射类型的优点在于通过修改""映射文件,就可以具有在部署时检测真实属性的能力。利用一个DOM解析器,也可以在程""序运行时操作映射文件。 更好的是,你可以通过<literal>Configuration</literal>对""象来访问(或者修改)Hibernate的运行时元模型。"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -