alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (component_mapping.po)

This example Hibernate source code file (component_mapping.po) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

a, cdata, cdata, hibernate, hibernate, name, orderline, person, string, tag, tag, the, the, you

The Hibernate component_mapping.po source code

# translation of Collection_Mapping.po to
# Xi HUANG <xhuang@redhat.com>, 2007, 2010.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-11T05:38:15\n"
"PO-Revision-Date: 2010-01-07 09:28+1000\n"
"Last-Translator: Xi HUANG <xhuang@redhat.com>\n"
"Language-Team:  <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"

#. Tag: title
#, no-c-format
msgid "Component Mapping"
msgstr "コンポーネントのマッピング"

#. Tag: para
#, no-c-format
msgid ""
"The notion of a <emphasis>component is re-used in several "
"different contexts and purposes throughout Hibernate."
msgstr ""
"<emphasis>コンポーネント の概念は、 Hibernate を通して様々な状況の"
"中で異なる目的のために再利用されます。"

#. Tag: title
#, no-c-format
msgid "Dependent objects"
msgstr "依存オブジェクト"

#. Tag: para
#, no-c-format
msgid ""
"A component is a contained object that is persisted as a value type and not "
"an entity reference. The term \"component\" refers to the object-oriented "
"notion of composition and not to architecture-level components. For example, "
"you can model a person like this:"
msgstr ""
"コンポーネントは、エンティティの参照ではなく値型として永続化された、包含され"
"たオブジェクトです。「コンポーネント」という言葉については、コンポジションと"
"いうオブジェクト指向の概念を参照してください(アーキテクチャレベルのコンポー"
"ネントではありません)。例えば、以下の Person モデルのようなものです。"

#. Tag: para
#, no-c-format
msgid ""
"Now <literal>Name can be persisted as a component of "
"<literal>Person. Name defines getter and setter "
"methods for its persistent properties, but it does not need to declare any "
"interfaces or identifier properties."
msgstr ""
"いま、 <literal>Name は Person のコンポーネント"
"として永続化することが出来ます。ここで <literal>Name は永続化属性に"
"対して getter 、 setter メソッドを定義しますが、インターフェースや識別子プロ"
"パティを定義する必要がないことに注意して下さい。"

#. Tag: para
#, no-c-format
msgid "Our Hibernate mapping would look like this:"
msgstr "マッピング定義は以下のようになります。"

#. Tag: para
#, no-c-format
msgid ""
"The person table would have the columns <literal>pid, "
"<literal>birthday, initial, firstlast."
msgstr ""
"Person テーブルは <literal>pid、 birthday、 "
"<literal>initial、 firstlast be considered an exotic usage. Hibernate is "
"intended to support a fine-grained object model."
msgstr ""
"コンポーネントの属性はどんな Hibernate の型でも構いません(コレクション、 "
"many-to-one 関連、他のコンポーネントなど)。ネストされたコンポーネントは滅多"
"に使わないと考えるべきでは <emphasis>ありません 。 Hibernate は非"
"常にきめの細かいオブジェクトモデルをサポートするように意図されています。"

#. Tag: para
#, no-c-format
msgid ""
"The <literal><component> element allows a <"
"parent></literal> subelement that maps a property of the component class "
"as a reference back to the containing entity."
msgstr ""
"<literal><component> 要素は、親エンティティへ戻る参照として、"
"コンポーネントのクラスのプロパティをマッピングする <literal><parent>). Declare your component collection by replacing the "
"<literal><element> tag with a <composite-"
"element></literal> tag:"
msgstr ""
"Hibernate はコンポーネントのコレクションをサポートしています(例えば "
"<literal>Name 型の配列)。 <element> タグ"
"を <literal><composite-element> タグに取り替えることによりコ"
"ンポーネントコレクションを宣言してください。"

#. Tag: para
#, no-c-format
msgid ""
"If you define a <literal>Set of composite elements, it is "
"important to implement <literal>equals() and hashCode() を定義したなら、 "
"<literal>equals()hashCode() を正しく実装する"
"ことが重要です。"

#. Tag: para
#, no-c-format
msgid ""
"Composite elements can contain components but not collections. If your "
"composite element contains components, use the <literal><nested-composite-"
"element></literal> tag. This case is a collection of components which "
"themselves have components. You may want to consider if a one-to-many "
"association is more appropriate. Remodel the composite element as an entity, "
"but be aware that even though the Java model is the same, the relational "
"model and persistence semantics are still slightly different."
msgstr ""
"コンポジットエレメントはコレクションを含まず、コンポーネントを含むこともあり"
"ます。コンポジットエレメント自身がコンポーネントを含んでいる場合は "
"<literal><nested-composite-element> を使用してください。コン"
"ポーネントのコレクション自身がコンポーネントを持つというケースはめったにあり"
"ません。この段階までに、 one-to-many 関連の方がより適切でないかと熟考してくだ"
"さい。コンポジットエレメントをエンティティとして再度モデリングしてみてくださ"
"い。しかしこれは Java のモデルとしては同じですが、リレーショナルモデルと永続"
"動作はまだ若干異なることに注意してください。"

#. Tag: para
#, no-c-format
msgid ""
"A composite element mapping does not support null-able properties if you are "
"using a <literal><set>. There is no separate primary key "
"column in the composite element table. Hibernate uses each column's value to "
"identify a record when deleting objects, which is not possible with null "
"values. You have to either use only not-null properties in a composite-"
"element or choose a <literal><list>, <map><bag> or <idbag>."
msgstr ""
"もし <literal><set> を使用するのであれば、コンポジットエレメ"
"ントのマッピングが null 値が可能な属性をサポートしていないことに注意してくだ"
"さい。 Hibernate はオブジェクトを削除するとき、レコードを識別するためにそれぞ"
"れのカラムの値を使用する必要があるため、 null 値を持つことが出来ません (コン"
"ポジットエレメントテーブルには別の主キーカラムはありません)。 コンポジットエ"
"レメントに not-null の属性のみを使用するか、または <literal><list><map>、 <bag>、"
"<literal><idbag> を選択する必要があります。"

#. Tag: para
#, no-c-format
msgid ""
"A special case of a composite element is a composite element with a nested "
"<literal><many-to-one> element. This mapping allows you to "
"map extra columns of a many-to-many association table to the composite "
"element class. The following is a many-to-many association from "
"<literal>Order to Item, where "
"<literal>purchaseDate, price and "
"<literal>quantity are properties of the association:"
msgstr ""
"コンポジットエレメントの特別なケースとして、ネストされた <literal><many-"
"to-one></literal> 属性を持つコンポジットエレメントがあります。このマッピン"
"グは、コンポジットエレメントクラスを多対多関連テーブルの余分なカラムへマッピ"
"ングします。次の例は <literal>Order から、Item "
"への多対多関連です。 <literal>purchaseDate、 pricequantity は関連の属性となります。"

#. Tag: para
#, no-c-format
msgid ""
"There cannot be a reference to the purchase on the other side for "
"bidirectional association navigation. Components are value types and do not "
"allow shared references. A single <literal>Purchase can be in the "
"set of an <literal>Order, but it cannot be referenced by the "
"<literal>Item at the same time."
msgstr ""
"もちろん、双方向関連のナビゲーションのために反対側から purchase への参照を作"
"ることは出来ません。コンポーネントは値型であり、参照を共有できないことを覚え"
"ておいてください。一つの <literal>Purchase は一つの "
"<literal>Order の set に存在できますが、同時に Item element allows you to map a "
"component class as the key of a <literal>Map. Ensure that you "
"override <literal>hashCode() and equals() "
"correctly on the component class."
msgstr ""
"<literal><composite-map-key> 要素は Map の"
"キーとしてコンポーネントクラスをマッピングします。コンポーネントクラス上で "
"<literal>hashCode() と equals() を正確にオーバー"
"ライドしてください。"

#. Tag: title
#, no-c-format
msgid "Components as composite identifiers"
msgstr "複合識別子としてのコンポーネント"

#. Tag: para
#, no-c-format
msgid ""
"You can use a component as an identifier of an entity class. Your component "
"class must satisfy certain requirements:"
msgstr ""
"コンポーネントをエンティティクラスの識別子として使うことができます。コンポー"
"ネントクラスは以下の条件を満たす必要があります。"

#. Tag: para
#, no-c-format
msgid "It must implement <literal>java.io.Serializable."
msgstr "<literal>java.io.Serializable を実装しなければなりません。"

#. Tag: para
#, no-c-format
msgid ""
"It must re-implement <literal>equals() and hashCode()hashCode() を再実装しなければなりません。"

#. Tag: title
#, no-c-format
msgid "Note"
msgstr "注記"

#. Tag: para
#, no-c-format
msgid ""
"In Hibernate3, although the second requirement is not an absolutely hard "
"requirement of Hibernate, it is recommended."
msgstr ""
"Hibernate3 において、2番目の条件は絶対的な条件ではありません。それでもやはり"
"条件を満たしてください。"

#. Tag: para
#, no-c-format
msgid ""
"You cannot use an <literal>IdentifierGenerator to generate "
"composite keys. Instead the application must assign its own identifiers."
msgstr ""
"複合キーを生成するために <literal>IdentifierGenerator を使用するこ"
"とはできません。代わりにアプリケーションが識別子を割り当てなくてはなりませ"
"ん。"

#. Tag: para
#, no-c-format
msgid ""
"Use the <literal><composite-id> tag, with nested "
"<literal><key-property> elements, in place of the usual "
"<literal><id> declaration. For example, the "
"<literal>OrderLine class has a primary key that depends upon the "
"(composite) primary key of <literal>Order."
msgstr ""
"通常の <literal><id> 宣言の代わりに <composite-"
"id></literal> タグを (ネストされた <key-property>OrderLine "
"クラスは <literal>Order の(複合)主キーに依存した主キーを持ってい"
"ます。"

#. Tag: para
#, no-c-format
msgid ""
"Any foreign keys referencing the <literal>OrderLine table are now "
"composite. Declare this in your mappings for other classes. An association "
"to <literal>OrderLine is mapped like this:"
msgstr ""
"このとき、 <literal>OrderLine テーブルへ関連する外部キーもまた複合"
"です。他のクラスのマッピングでこれを宣言しなければなりません。 "
"<literal>OrderLine への関連は次のようにマッピングされます。"

#. Tag: para
#, fuzzy, no-c-format
msgid ""
"The <literal>column element is an alternative to the "
"<literal>column attribute everywhere. Using the column"
msgstr ""
"(<literal><column> タグはどこであっても column association to OrderLine への many-to-many 関連も複合"
"外部キーを使います。"

#. Tag: para
#, no-c-format
msgid ""
"The collection of <literal>OrderLines in Order "
"would use:"
msgstr ""
"<literal>Order にある OrderLine のコレクションは"
"次のものを使用します。"

#. Tag: para
#, no-c-format
msgid "The <literal><one-to-many> element declares no columns."
msgstr ""
"(<literal><one-to-many> 属性は、例によってカラムを宣言しませ"
"ん)"

#. Tag: para
#, no-c-format
msgid ""
"If <literal>OrderLine itself owns a collection, it also has a "
"composite foreign key."
msgstr ""
"<literal>OrderLine 自身がコレクションを持っている場合、同時に複合外"
"部キーも持っています。"

#. Tag: title
#, no-c-format
msgid "Dynamic components"
msgstr "動的コンポーネント"

#. Tag: para
#, no-c-format
msgid "You can also map a property of type <literal>Map:"
msgstr "<literal>Map 型のプロパティのマッピングも可能です。"

#. Tag: para
#, no-c-format
msgid ""
"The semantics of a <literal><dynamic-component> mapping are "
"identical to <literal><component>. 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. "
"You can also access, and change, Hibernate's configuration-time metamodel "
"via the <literal>Configuration object."
msgstr ""
"<literal><dynamic-component> マッピングのセマンティクスは "
"<literal><component> と同一のものです。この種のマッピングの利"
"点は、マッピングドキュメントの編集により、配置時に Bean の属性を決定できる点"
"です。また、 DOM パーサを利用して、マッピングドキュメントのランタイム操作が可"
"能です。さらに、 <literal>Configuration オブジェクト経由で "
"Hibernate のコンフィグレーション時のメタモデルにアクセス(または変更)が可能"
"です。"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[public class Person {\n"
#~ "    private java.util.Date birthday;\n"
#~ "    private Name name;\n"
#~ "    private String key;\n"
#~ "    public String getKey() {\n"
#~ "        return key;\n"
#~ "    }\n"
#~ "    private void setKey(String key) {\n"
#~ "        this.key=key;\n"
#~ "    }\n"
#~ "    public java.util.Date getBirthday() {\n"
#~ "        return birthday;\n"
#~ "    }\n"
#~ "    public void setBirthday(java.util.Date birthday) {\n"
#~ "        this.birthday = birthday;\n"
#~ "    }\n"
#~ "    public Name getName() {\n"
#~ "        return name;\n"
#~ "    }\n"
#~ "    public void setName(Name name) {\n"
#~ "        this.name = name;\n"
#~ "    }\n"
#~ "    ......\n"
#~ "    ......\n"
#~ "}]]>"
#~ msgstr ""
#~ "public class Person {\n"
#~ "    private java.util.Date birthday;\n"
#~ "    private Name name;\n"
#~ "    private String key;\n"
#~ "    public String getKey() {\n"
#~ "        return key;\n"
#~ "    }\n"
#~ "    private void setKey(String key) {\n"
#~ "        this.key=key;\n"
#~ "    }\n"
#~ "    public java.util.Date getBirthday() {\n"
#~ "        return birthday;\n"
#~ "    }\n"
#~ "    public void setBirthday(java.util.Date birthday) {\n"
#~ "        this.birthday = birthday;\n"
#~ "    }\n"
#~ "    public Name getName() {\n"
#~ "        return name;\n"
#~ "    }\n"
#~ "    public void setName(Name name) {\n"
#~ "        this.name = name;\n"
#~ "    }\n"
#~ "    ......\n"
#~ "    ......\n"
#~ "}"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[public class Name {\n"
#~ "    char initial;\n"
#~ "    String first;\n"
#~ "    String last;\n"
#~ "    public String getFirst() {\n"
#~ "        return first;\n"
#~ "    }\n"
#~ "    void setFirst(String first) {\n"
#~ "        this.first = first;\n"
#~ "    }\n"
#~ "    public String getLast() {\n"
#~ "        return last;\n"
#~ "    }\n"
#~ "    void setLast(String last) {\n"
#~ "        this.last = last;\n"
#~ "    }\n"
#~ "    public char getInitial() {\n"
#~ "        return initial;\n"
#~ "    }\n"
#~ "    void setInitial(char initial) {\n"
#~ "        this.initial = initial;\n"
#~ "    }\n"
#~ "}]]>"
#~ msgstr ""
#~ "public class Name {\n"
#~ "    char initial;\n"
#~ "    String first;\n"
#~ "    String last;\n"
#~ "    public String getFirst() {\n"
#~ "        return first;\n"
#~ "    }\n"
#~ "    void setFirst(String first) {\n"
#~ "        this.first = first;\n"
#~ "    }\n"
#~ "    public String getLast() {\n"
#~ "        return last;\n"
#~ "    }\n"
#~ "    void setLast(String last) {\n"
#~ "        this.last = last;\n"
#~ "    }\n"
#~ "    public char getInitial() {\n"
#~ "        return initial;\n"
#~ "    }\n"
#~ "    void setInitial(char initial) {\n"
#~ "        this.initial = initial;\n"
#~ "    }\n"
#~ "}"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<class name=\"eg.Person\" table=\"person\">\n"
#~ "    <id name=\"Key\" column=\"pid\" type=\"string\">\n"
#~ "        <generator class=\"uuid\"/>\n"
#~ "    </id>\n"
#~ "    <property name=\"birthday\" type=\"date\"/>\n"
#~ "    <component name=\"Name\" class=\"eg.Name\"> <!-- class "
#~ "attribute optional -->\n"
#~ "        <property name=\"initial\"/>\n"
#~ "        <property name=\"first\"/>\n"
#~ "        <property name=\"last\"/>\n"
#~ "    </component>\n"
#~ "</class>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<class name=\"eg.Person\" table=\"person\">\n"
#~ "    <id name=\"Key\" column=\"pid\" type=\"string\">\n"
#~ "        <generator class=\"uuid\"/>\n"
#~ "    </id>\n"
#~ "    <property name=\"birthday\" type=\"date\"/>\n"
#~ "    <component name=\"Name\" class=\"eg.Name\" unique=\"true\">\n"
#~ "        <parent name=\"namedPerson\"/> <!-- reference back to "
#~ "the Person -->\n"
#~ "        <property name=\"initial\"/>\n"
#~ "        <property name=\"first\"/>\n"
#~ "        <property name=\"last\"/>\n"
#~ "    </component>\n"
#~ "</class>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<set name=\"someNames\" table=\"some_names\" lazy=\"true\">\n"
#~ "    <key column=\"id\"/>\n"
#~ "    <composite-element class=\"eg.Name\"> <!-- class attribute "
#~ "required -->\n"
#~ "        <property name=\"initial\"/>\n"
#~ "        <property name=\"first\"/>\n"
#~ "        <property name=\"last\"/>\n"
#~ "    </composite-element>\n"
#~ "</set>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA[\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 ""
#~ "<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>"

#, fuzzy
#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<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>"

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate component_mapping.po source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.