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

📄 inheritance_mapping.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 2 页
字号:
#: inheritance_mapping.xml:194#, no-c-formatmsgid """The limitation of this approach is that if a property is mapped on the ""superclass, the column name must be the same on all subclass tables. (We ""might relax this in a future release of Hibernate.) The identity generator ""strategy is not allowed in union subclass inheritance, indeed the primary ""key seed has to be shared accross all unioned subclasses of a hierarchy."msgstr """这种方式的局限在于,如果一个属性在超类中做了映射,其字段名必须与所有子类 表中""定义的相同。(我们可能会在Hibernate的后续发布版本中放宽此限制。) 不允许在联合""子类(union subclass)的继承层次中使用标识生成器策略(identity generator ""strategy), 实际上, 主键的种子(primary key seed)不得不为同一继承层次中的全部被""联合子类所共用."#. Tag: para#: inheritance_mapping.xml:203#, no-c-formatmsgid """If your superclass is abstract, map it with <literal>abstract=\"true\"</""literal>. Of course, if it is not abstract, an additional table (defaults to ""<literal>PAYMENT</literal> in the example above) is needed to hold instances ""of the superclass."msgstr """假若超类是抽象类,请使用<literal>abstract=\"true\"</literal>。当然,假若它不""是抽象的,需要一个额外的表(上面的例子中,默认是<literal>PAYMENT</""literal>),来保存超类的实例。"#. Tag: title#: inheritance_mapping.xml:213#, no-c-formatmsgid "Table per concrete class, using implicit polymorphism"msgstr "每个具体类一张表,使用隐式多态"#. Tag: para#: inheritance_mapping.xml:215#, no-c-formatmsgid "An alternative approach is to make use of implicit polymorphism:"msgstr "另一种可供选择的方法是采用隐式多态:"#. Tag: programlisting#: inheritance_mapping.xml:219#, no-c-formatmsgid """<![CDATA[<class name=\"CreditCardPayment\" table=\"CREDIT_PAYMENT\">\n""    <id name=\"id\" type=\"long\" column=\"CREDIT_PAYMENT_ID\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <property name=\"amount\" column=\"CREDIT_AMOUNT\"/>\n""    ...\n""</class>\n""\n""<class name=\"CashPayment\" table=\"CASH_PAYMENT\">\n""    <id name=\"id\" type=\"long\" column=\"CASH_PAYMENT_ID\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <property name=\"amount\" column=\"CASH_AMOUNT\"/>\n""    ...\n""</class>\n""\n""<class name=\"ChequePayment\" table=\"CHEQUE_PAYMENT\">\n""    <id name=\"id\" type=\"long\" column=\"CHEQUE_PAYMENT_ID\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <property name=\"amount\" column=\"CHEQUE_AMOUNT\"/>\n""    ...\n""</class>]]>"msgstr ""#. Tag: para#: inheritance_mapping.xml:221#, no-c-formatmsgid """Notice that nowhere do we mention the <literal>Payment</literal> interface ""explicitly. Also notice that properties of <literal>Payment</literal> are ""mapped in each of the subclasses. If you want to avoid duplication, consider ""using XML entities (e.g. <literal>[ &lt;!ENTITY allproperties SYSTEM ""\"allproperties.xml\"&gt; ]</literal> in the <literal>DOCTYPE</literal> ""declartion and <literal>&amp;allproperties;</literal> in the mapping)."msgstr """注意,我们没有在任何地方明确的提及接口<literal>Payment</literal>。同时注意 ""<literal>Payment</literal>的属性在每个子类中都进行了映射。如果你想避免重复, ""可以考虑使用XML实体(例如:位于<literal>DOCTYPE</literal>声明内的 <literal>""[ &lt;!ENTITY allproperties SYSTEM \"allproperties.xml\"&gt; ]</literal> 和映""射中的<literal>&amp;allproperties;</literal>)。"#. Tag: para#: inheritance_mapping.xml:231#, no-c-formatmsgid """The disadvantage of this approach is that Hibernate does not generate SQL ""<literal>UNION</literal>s when performing polymorphic queries."msgstr """这种方法的缺陷在于,在Hibernate执行多态查询时(polymorphic queries)无法生成带 ""<literal>UNION</literal>的SQL语句。"#. Tag: para#: inheritance_mapping.xml:236#, no-c-formatmsgid """For this mapping strategy, a polymorphic association to <literal>Payment</""literal> is usually mapped using <literal>&lt;any&gt;</literal>."msgstr """对于这种映射策略而言,通常用<literal>&lt;any&gt;</literal>来实现到 ""<literal>Payment</literal>的多态关联映射。"#. Tag: programlisting#: inheritance_mapping.xml:241#, no-c-formatmsgid """<![CDATA[<any name=\"payment\" meta-type=\"string\" id-type=\"long\">\n""    <meta-value value=\"CREDIT\" class=\"CreditCardPayment\"/>\n""    <meta-value value=\"CASH\" class=\"CashPayment\"/>\n""    <meta-value value=\"CHEQUE\" class=\"ChequePayment\"/>\n""    <column name=\"PAYMENT_CLASS\"/>\n""    <column name=\"PAYMENT_ID\"/>\n""</any>]]>"msgstr ""#. Tag: title#: inheritance_mapping.xml:246#, no-c-formatmsgid "Mixing implicit polymorphism with other inheritance mappings"msgstr "隐式多态和其他继承映射混合使用"#. Tag: para#: inheritance_mapping.xml:248#, no-c-formatmsgid """There is one further thing to notice about this mapping. Since the ""subclasses are each mapped in their own <literal>&lt;class&gt;</literal> ""element (and since <literal>Payment</literal> is just an interface), each of ""the subclasses could easily be part of another inheritance hierarchy! (And ""you can still use polymorphic queries against the <literal>Payment</literal> ""interface.)"msgstr """对这一映射还有一点需要注意。因为每个子类都在各自独立的元素<literal>&lt;""class&gt;</literal> 中映射(并且<literal>Payment</literal>只是一个接口),每个""子类可以很容易的成为另一 个继承体系中的一部分!(你仍然可以对接口""<literal>Payment</literal>使用多态查询。)"#. Tag: programlisting#: inheritance_mapping.xml:256#, no-c-formatmsgid """<![CDATA[<class name=\"CreditCardPayment\" table=\"CREDIT_PAYMENT\">\n""    <id name=\"id\" type=\"long\" column=\"CREDIT_PAYMENT_ID\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <discriminator column=\"CREDIT_CARD\" type=\"string\"/>\n""    <property name=\"amount\" column=\"CREDIT_AMOUNT\"/>\n""    ...\n""    <subclass name=\"MasterCardPayment\" discriminator-value=\"MDC\"/>\n""    <subclass name=\"VisaPayment\" discriminator-value=\"VISA\"/>\n""</class>\n""\n""<class name=\"NonelectronicTransaction\" table=\"NONELECTRONIC_TXN\">\n""    <id name=\"id\" type=\"long\" column=\"TXN_ID\">\n""        <generator class=\"native\"/>\n""    </id>\n""    ...\n""    <joined-subclass name=\"CashPayment\" table=\"CASH_PAYMENT\">\n""        <key column=\"PAYMENT_ID\"/>\n""        <property name=\"amount\" column=\"CASH_AMOUNT\"/>\n""        ...\n""    </joined-subclass>\n""    <joined-subclass name=\"ChequePayment\" table=\"CHEQUE_PAYMENT\">\n""        <key column=\"PAYMENT_ID\"/>\n""        <property name=\"amount\" column=\"CHEQUE_AMOUNT\"/>\n""        ...\n""    </joined-subclass>\n""</class>]]>"msgstr ""#. Tag: para#: inheritance_mapping.xml:258#, no-c-formatmsgid """Once again, we don't mention <literal>Payment</literal> explicitly. If we ""execute a query against the <literal>Payment</literal> interface - for ""example, <literal>from Payment</literal> - Hibernate automatically returns ""instances of <literal>CreditCardPayment</literal> (and its subclasses, since ""they also implement <literal>Payment</literal>), <literal>CashPayment</""literal> and <literal>ChequePayment</literal> but not instances of ""<literal>NonelectronicTransaction</literal>."msgstr """我们还是没有明确的提到<literal>Payment</literal>。 如果我们针对接口""<literal>Payment</literal>执行查询 ——如<literal>from Payment</literal>—— ""Hibernate 自动返回<literal>CreditCardPayment</literal>(和它的子类,因为 它们""也实现了接口<literal>Payment</literal>)、 <literal>CashPayment</literal>和""<literal>Chequepayment</literal>的实例, 但不返回""<literal>NonelectronicTransaction</literal>的实例。"#. Tag: title#: inheritance_mapping.xml:273#, no-c-formatmsgid "Limitations"msgstr "限制"#. Tag: para#: inheritance_mapping.xml:275#, no-c-formatmsgid """There are certain limitations to the \"implicit polymorphism\" approach to ""the table per concrete-class mapping strategy. There are somewhat less ""restrictive limitations to <literal>&lt;union-subclass&gt;</literal> ""mappings."msgstr """对“每个具体类映射一张表”(table per concrete-class)的映射策略而言,隐式多态""的 方式有一定的限制。而<literal>&lt;union-subclass&gt;</literal>映射的限制则""没有那 么严格。"#. Tag: para#: inheritance_mapping.xml:282#, no-c-formatmsgid """The following table shows the limitations of table per concrete-class ""mappings, and of implicit polymorphism, in Hibernate."msgstr "下面表格中列出了在Hibernte中“每个具体类一张表”的策略和隐式多态的限制。"#. Tag: title#: inheritance_mapping.xml:288#, no-c-formatmsgid "Features of inheritance mappings"msgstr "继承映射特性(Features of inheritance mappings)"#. Tag: entry#: inheritance_mapping.xml:300#, no-c-formatmsgid "Inheritance strategy"msgstr "继承策略(Inheritance strategy)"#. Tag: entry#: inheritance_mapping.xml:301#, no-c-formatmsgid "Polymorphic many-to-one"msgstr "多态多对一"#. Tag: entry#: inheritance_mapping.xml:302#, no-c-formatmsgid "Polymorphic one-to-one"msgstr "多态一对一"#. Tag: entry#: inheritance_mapping.xml:303#, no-c-formatmsgid "Polymorphic one-to-many"msgstr "多态一对多"#. Tag: entry#: inheritance_mapping.xml:304#, no-c-formatmsgid "Polymorphic many-to-many"msgstr "多态多对多"#. Tag: entry#: inheritance_mapping.xml:305#, no-c-formatmsgid "Polymorphic <literal>load()/get()</literal>"msgstr ""#. Tag: entry#: inheritance_mapping.xml:306#, no-c-formatmsgid "Polymorphic queries"msgstr "多态查询"#. Tag: entry#: inheritance_mapping.xml:307#, no-c-formatmsgid "Polymorphic joins"msgstr "多态连接(join)"#. Tag: entry#: inheritance_mapping.xml:308#, no-c-formatmsgid "Outer join fetching"msgstr "外连接(Outer join)读取"#. Tag: entry#: inheritance_mapping.xml:313#, no-c-formatmsgid "table per class-hierarchy"msgstr "每个类分层结构一张表"#. Tag: literal#: inheritance_mapping.xml:314 inheritance_mapping.xml:325#: inheritance_mapping.xml:336#, no-c-formatmsgid "&lt;many-to-one&gt;"msgstr "&lt;many-to-one&gt;"#. Tag: literal#: inheritance_mapping.xml:315 inheritance_mapping.xml:326#: inheritance_mapping.xml:337#, no-c-formatmsgid "&lt;one-to-one&gt;"msgstr "&lt;one-to-one&gt;"#. Tag: literal#: inheritance_mapping.xml:316 inheritance_mapping.xml:327#, no-c-formatmsgid "&lt;one-to-many&gt;"msgstr "&lt;one-to-many&gt;"#. Tag: literal#: inheritance_mapping.xml:317 inheritance_mapping.xml:328#: inheritance_mapping.xml:339#, no-c-formatmsgid "&lt;many-to-many&gt;"msgstr "&lt;many-to-many&gt;"#. Tag: literal#: inheritance_mapping.xml:318 inheritance_mapping.xml:329#: inheritance_mapping.xml:340#, no-c-formatmsgid "s.get(Payment.class, id)"msgstr "s.get(Payment.class, id)"#. Tag: literal#: inheritance_mapping.xml:319 inheritance_mapping.xml:330#: inheritance_mapping.xml:341 inheritance_mapping.xml:352#, no-c-formatmsgid "from Payment p"msgstr "from Payment p"#. Tag: literal#: inheritance_mapping.xml:320 inheritance_mapping.xml:331#: inheritance_mapping.xml:342#, no-c-formatmsgid "from Order o join o.payment p"msgstr "from Order o join o.payment p"#. Tag: emphasis#: inheritance_mapping.xml:321 inheritance_mapping.xml:332#: inheritance_mapping.xml:343#, no-c-formatmsgid "supported"msgstr "支持"#. Tag: entry#: inheritance_mapping.xml:324#, fuzzy, no-c-formatmsgid "<entry>table per subclass</entry>"msgstr """#-#-#-#-#  - (PACKAGE VERSION)  #-#-#-#-#\n""每个子类一张表(table per subclass)\n""#-#-#-#-#  - (PACKAGE VERSION)  #-#-#-#-#\n""每个子类一张表"#. Tag: entry#: inheritance_mapping.xml:335#, no-c-formatmsgid "table per concrete-class (union-subclass)"msgstr "每个具体类一张表(union-subclass)"#. Tag: entry#: inheritance_mapping.xml:338#, no-c-formatmsgid """<literal>&lt;one-to-many&gt;</literal> (for <literal>inverse=\"true\"</""literal> only)"msgstr ""#. Tag: entry#: inheritance_mapping.xml:346#, no-c-formatmsgid "table per concrete class (implicit polymorphism)"msgstr "每个具体类一张表(隐式多态)"#. Tag: literal#: inheritance_mapping.xml:347#, no-c-formatmsgid "&lt;any&gt;"msgstr "&lt;any&gt;"#. Tag: emphasis#: inheritance_mapping.xml:348 inheritance_mapping.xml:349#: inheritance_mapping.xml:353 inheritance_mapping.xml:354#, no-c-formatmsgid "not supported"msgstr "不支持"#. Tag: literal#: inheritance_mapping.xml:350#, no-c-formatmsgid "&lt;many-to-any&gt;"msgstr "&lt;many-to-any&gt;"#. Tag: literal#: inheritance_mapping.xml:351#, no-c-formatmsgid """s.createCriteria(Payment.class).add( Restrictions.idEq(id) ).uniqueResult()"msgstr """s.createCriteria(Payment.class).add( Restrictions.idEq(id) ).uniqueResult()"#~ msgid "load()/get()"#~ msgstr "load()/get()"#~ msgid "Polymorphic <placeholder-1/>"#~ msgstr "多态 <placeholder-1/>"#~ msgid "inverse=\"true\""#~ msgstr "inverse=\"true\""#~ msgid "<placeholder-1/> (for <placeholder-2/> only)"#~ msgstr "<placeholder-1/> (仅对于<placeholder-2/>的情况)"

⌨️ 快捷键说明

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