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

Hibernate example source code file (example_mappings.po)

This example Hibernate source code file (example_mappings.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

author, bigint, bigint, cdata, cdata, customer, lineitem, order, person, product, tag, tag, varchar, varchar

The Hibernate example_mappings.po source code

# translation of Collection_Mapping.po to
# Xi Huang <xhuang@redhat.com>, 2006.
# Xi HUANG <xhuang@redhat.com>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-10T07:25:35\n"
"PO-Revision-Date: 2009-11-20 18:36+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 "Example: Various Mappings"
msgstr "示例:复杂映射实例"

#. Tag: para
#, no-c-format
msgid "This chapters explores some more complex association mappings."
msgstr "本章展示了一些较为复杂的关系映射。 "

#. Tag: title
#, no-c-format
msgid "Employer/Employee"
msgstr "Employer(雇主)/Employee(雇员)"

#. Tag: para
#, no-c-format
msgid ""
"The following model of the relationship between <literal>Employer "
"and <literal>Employee uses an entity class (EmploymentEmployee 的关系模"
"型使用了一个真实的实体类(<literal>Employment)来表述,这是因为对于"
"相同的雇员和雇主可能会有多个雇佣时间段。对于金额和雇员姓名,用 Components 建"
"模。 "

#. Tag: para
#, no-c-format
msgid "Here is a possible mapping document:"
msgstr "映射文件可能是这样: "

#. Tag: para
#, no-c-format
msgid "Here is the table schema generated by <literal>SchemaExport."
msgstr "用 <literal>SchemaExport 生成表结构。 "

#. Tag: title
#, no-c-format
msgid "Author/Work"
msgstr "Author(作家)/Work(作品)"

#. Tag: para
#, no-c-format
msgid ""
"Consider the following model of the relationships between <literal>WorkAuthor and Person. In the "
"example, the relationship between <literal>Work and "
"<literal>Author is represented as a many-to-many association and "
"the relationship between <literal>Author and Person extend Person."
msgstr ""
"考虑下面的 <literal>WorkAuthor 和 "
"<literal>Person 模型的关系。我们用多对多关系来描述 WorkAuthor,用一对一关系来描述 AuthorPerson,另一种可能性是 AuthorPerson。 "

#. Tag: para
#, no-c-format
msgid ""
"The following mapping document correctly represents these relationships:"
msgstr "下面的映射文件正确的描述了这些关系:"

#. Tag: para
#, no-c-format
msgid ""
"There are four tables in this mapping: <literal>works, "
"<literal>authors and persons hold work, author "
"and person data respectively. <literal>author_work is an "
"association table linking authors to works. Here is the table schema, as "
"generated by <literal>SchemaExport:"
msgstr ""
"映射中有 4 个表。<literal>works,authors 和 "
"<literal>persons 分别保存着 work,author 和 person 的数据。"
"<literal>author_work 是 authors 和 works 的关联表。表结构是由 "
"<literal>SchemaExport 生成的:"

#. Tag: title
#, no-c-format
msgid "Customer/Order/Product"
msgstr "Customer(客户)/Order(订单)/Product(产品)"

#. Tag: para
#, no-c-format
msgid ""
"In this section we consider a model of the relationships between "
"<literal>Customer, Order, Line ItemProduct. There is a one-to-many association "
"between <literal>Customer and Order, but how "
"can you represent <literal>Order / LineItem / "
"<literal>Product? In the example, LineItem is "
"mapped as an association class representing the many-to-many association "
"between <literal>Order and Product. In "
"Hibernate this is called a composite element."
msgstr ""
"现在来考虑 <literal>Customer,Order, "
"<literal>LineItem 和 Product 关系的模型。"
"<literal>Customer 和 Order 之间 是一对多的关系,"
"但是我们怎么来描述 <literal>Order / LineItem / "
"<literal>Product呢? 我可以把 LineItem 作为描述 "
"<literal>Order 和  Product 多对多关系的关联类,"
"在 Hibernate,这叫做组合元素。 "

#. Tag: para
#, no-c-format
msgid "The mapping document will look like this:"
msgstr "映射文件如下: "

#. Tag: para
#, no-c-format
msgid ""
"<literal>customers, orders, "
"<literal>line_items and products hold customer, "
"order, order line item and product data respectively. <literal>line_itemsorders,"
"<literal>line_items 和  products 分别保存着 "
"customer,order,order line item 和 product 的数据。 <literal>line_items 目录。 "

#. Tag: title
#, no-c-format
msgid "\"Typed\" one-to-one association"
msgstr "\"Typed\" 一对一关联"

#. Tag: title
#, no-c-format
msgid "Composite key example"
msgstr "组合键示例"

#. Tag: title
#, no-c-format
msgid "Many-to-many with shared composite key attribute"
msgstr ""
"共有组合键属性的多对多(Many-to-many with shared composite key attribute)"

#. Tag: title
#, no-c-format
msgid "Content based discrimination"
msgstr "基于内容的识别"

#. Tag: title
#, no-c-format
msgid "Associations on alternate keys"
msgstr "备用键的联合"

#~ msgid ""
#~ "<![CDATA[\n"
#~ "            </generator>\n"
#~ "        </id>\n"
#~ "        <property name=\"name\"/>\n"
#~ "    </class>\n"
#~ "\n"
#~ "    <class name=\"Employment\" table=\"employment_periods\">\n"
#~ "\n"
#~ "        <id name=\"id\">\n"
#~ "            <generator class=\"sequence\">\n"
#~ "                <param name=\"sequence\">employment_id_seq\n"
#~ "            </generator>\n"
#~ "        </id>\n"
#~ "        <property name=\"startDate\" column=\"start_date\"/>\n"
#~ "        <property name=\"endDate\" column=\"end_date\"/>\n"
#~ "\n"
#~ "        <component name=\"hourlyRate\" class=\"MonetaryAmount\">\n"
#~ "            <property name=\"amount\">\n"
#~ "                <column name=\"hourly_rate\" sql-type=\"NUMERIC(12, 2)\"/"
#~ ">\n"
#~ "            </property>\n"
#~ "            <property name=\"currency\" length=\"12\"/>\n"
#~ "        </component>\n"
#~ "\n"
#~ "        <many-to-one name=\"employer\" column=\"employer_id\" not-null="
#~ "\"true\"/>\n"
#~ "        <many-to-one name=\"employee\" column=\"employee_id\" not-null="
#~ "\"true\"/>\n"
#~ "\n"
#~ "    </class>\n"
#~ "\n"
#~ "    <class name=\"Employee\" table=\"employees\">\n"
#~ "        <id name=\"id\">\n"
#~ "            <generator class=\"sequence\">\n"
#~ "                <param name=\"sequence\">employee_id_seq\n"
#~ "            </generator>\n"
#~ "        </id>\n"
#~ "        <property name=\"taxfileNumber\"/>\n"
#~ "        <component name=\"name\" class=\"Name\">\n"
#~ "            <property name=\"firstName\"/>\n"
#~ "            <property name=\"initial\"/>\n"
#~ "            <property name=\"lastName\"/>\n"
#~ "        </component>\n"
#~ "    </class>\n"
#~ "\n"
#~ "</hibernate-mapping>]]>"
#~ msgstr ""
#~ "<![CDATA[\n"
#~ "            </generator>\n"
#~ "        </id>\n"
#~ "        <property name=\"name\"/>\n"
#~ "    </class>\n"
#~ "\n"
#~ "    <class name=\"Employment\" table=\"employment_periods\">\n"
#~ "\n"
#~ "        <id name=\"id\">\n"
#~ "            <generator class=\"sequence\">\n"
#~ "                <param name=\"sequence\">employment_id_seq\n"
#~ "            </generator>\n"
#~ "        </id>\n"
#~ "        <property name=\"startDate\" column=\"start_date\"/>\n"
#~ "        <property name=\"endDate\" column=\"end_date\"/>\n"
#~ "\n"
#~ "        <component name=\"hourlyRate\" class=\"MonetaryAmount\">\n"
#~ "            <property name=\"amount\">\n"
#~ "                <column name=\"hourly_rate\" sql-type=\"NUMERIC(12, 2)\"/"
#~ ">\n"
#~ "            </property>\n"
#~ "            <property name=\"currency\" length=\"12\"/>\n"
#~ "        </component>\n"
#~ "\n"
#~ "        <many-to-one name=\"employer\" column=\"employer_id\" not-null="
#~ "\"true\"/>\n"
#~ "        <many-to-one name=\"employee\" column=\"employee_id\" not-null="
#~ "\"true\"/>\n"
#~ "\n"
#~ "    </class>\n"
#~ "\n"
#~ "    <class name=\"Employee\" table=\"employees\">\n"
#~ "        <id name=\"id\">\n"
#~ "            <generator class=\"sequence\">\n"
#~ "                <param name=\"sequence\">employee_id_seq\n"
#~ "            </generator>\n"
#~ "        </id>\n"
#~ "        <property name=\"taxfileNumber\"/>\n"
#~ "        <component name=\"name\" class=\"Name\">\n"
#~ "            <property name=\"firstName\"/>\n"
#~ "            <property name=\"initial\"/>\n"
#~ "            <property name=\"lastName\"/>\n"
#~ "        </component>\n"
#~ "    </class>\n"
#~ "\n"
#~ "</hibernate-mapping>]]>"

#~ msgid ""
#~ "<![CDATA[create table employers (\n"
#~ "    id BIGINT not null, \n"
#~ "    name VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table employment_periods (\n"
#~ "    id BIGINT not null,\n"
#~ "    hourly_rate NUMERIC(12, 2),\n"
#~ "    currency VARCHAR(12), \n"
#~ "    employee_id BIGINT not null, \n"
#~ "    employer_id BIGINT not null, \n"
#~ "    end_date TIMESTAMP, \n"
#~ "    start_date TIMESTAMP, \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table employees (\n"
#~ "    id BIGINT not null, \n"
#~ "    firstName VARCHAR(255), \n"
#~ "    initial CHAR(1), \n"
#~ "    lastName VARCHAR(255), \n"
#~ "    taxfileNumber VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "alter table employment_periods \n"
#~ "    add constraint employment_periodsFK0 foreign key (employer_id) "
#~ "references employers\n"
#~ "alter table employment_periods \n"
#~ "    add constraint employment_periodsFK1 foreign key (employee_id) "
#~ "references employees\n"
#~ "create sequence employee_id_seq\n"
#~ "create sequence employment_id_seq\n"
#~ "create sequence employer_id_seq]]>"
#~ msgstr ""
#~ "<![CDATA[create table employers (\n"
#~ "    id BIGINT not null, \n"
#~ "    name VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table employment_periods (\n"
#~ "    id BIGINT not null,\n"
#~ "    hourly_rate NUMERIC(12, 2),\n"
#~ "    currency VARCHAR(12), \n"
#~ "    employee_id BIGINT not null, \n"
#~ "    employer_id BIGINT not null, \n"
#~ "    end_date TIMESTAMP, \n"
#~ "    start_date TIMESTAMP, \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table employees (\n"
#~ "    id BIGINT not null, \n"
#~ "    firstName VARCHAR(255), \n"
#~ "    initial CHAR(1), \n"
#~ "    lastName VARCHAR(255), \n"
#~ "    taxfileNumber VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "alter table employment_periods \n"
#~ "    add constraint employment_periodsFK0 foreign key (employer_id) "
#~ "references employers\n"
#~ "alter table employment_periods \n"
#~ "    add constraint employment_periodsFK1 foreign key (employee_id) "
#~ "references employees\n"
#~ "create sequence employee_id_seq\n"
#~ "create sequence employment_id_seq\n"
#~ "create sequence employer_id_seq]]>"

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

#~ msgid ""
#~ "<![CDATA[create table works (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    tempo FLOAT, \n"
#~ "    genre VARCHAR(255), \n"
#~ "    text INTEGER, \n"
#~ "    title VARCHAR(255), \n"
#~ "    type CHAR(1) not null, \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table author_work (\n"
#~ "    author_id BIGINT not null, \n"
#~ "    work_id BIGINT not null, \n"
#~ "    primary key (work_id, author_id)\n"
#~ ")\n"
#~ "\n"
#~ "create table authors (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    alias VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table persons (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    name VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "alter table authors \n"
#~ "    add constraint authorsFK0 foreign key (id) references persons\n"
#~ "alter table author_work \n"
#~ "    add constraint author_workFK0 foreign key (author_id) references "
#~ "authors\n"
#~ "alter table author_work\n"
#~ "    add constraint author_workFK1 foreign key (work_id) references works]]"
#~ ">"
#~ msgstr ""
#~ "<![CDATA[create table works (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    tempo FLOAT, \n"
#~ "    genre VARCHAR(255), \n"
#~ "    text INTEGER, \n"
#~ "    title VARCHAR(255), \n"
#~ "    type CHAR(1) not null, \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table author_work (\n"
#~ "    author_id BIGINT not null, \n"
#~ "    work_id BIGINT not null, \n"
#~ "    primary key (work_id, author_id)\n"
#~ ")\n"
#~ "\n"
#~ "create table authors (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    alias VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table persons (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    name VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "alter table authors \n"
#~ "    add constraint authorsFK0 foreign key (id) references persons\n"
#~ "alter table author_work \n"
#~ "    add constraint author_workFK0 foreign key (author_id) references "
#~ "authors\n"
#~ "alter table author_work\n"
#~ "    add constraint author_workFK1 foreign key (work_id) references works]]"
#~ ">"

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

#~ msgid ""
#~ "<![CDATA[create table customers (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    name VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table orders (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    customer_id BIGINT, \n"
#~ "    date TIMESTAMP, \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table line_items (\n"
#~ "    line_number INTEGER not null, \n"
#~ "    order_id BIGINT not null, \n"
#~ "    product_id BIGINT, \n"
#~ "    quantity INTEGER, \n"
#~ "    primary key (order_id, line_number)\n"
#~ ")\n"
#~ "\n"
#~ "create table products (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    serialNumber VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "alter table orders \n"
#~ "    add constraint ordersFK0 foreign key (customer_id) references "
#~ "customers\n"
#~ "alter table line_items\n"
#~ "    add constraint line_itemsFK0 foreign key (product_id) references "
#~ "products\n"
#~ "alter table line_items\n"
#~ "    add constraint line_itemsFK1 foreign key (order_id) references "
#~ "orders]]>"
#~ msgstr ""
#~ "<![CDATA[create table customers (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    name VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table orders (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    customer_id BIGINT, \n"
#~ "    date TIMESTAMP, \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "create table line_items (\n"
#~ "    line_number INTEGER not null, \n"
#~ "    order_id BIGINT not null, \n"
#~ "    product_id BIGINT, \n"
#~ "    quantity INTEGER, \n"
#~ "    primary key (order_id, line_number)\n"
#~ ")\n"
#~ "\n"
#~ "create table products (\n"
#~ "    id BIGINT not null generated by default as identity, \n"
#~ "    serialNumber VARCHAR(255), \n"
#~ "    primary key (id)\n"
#~ ")\n"
#~ "\n"
#~ "alter table orders \n"
#~ "    add constraint ordersFK0 foreign key (customer_id) references "
#~ "customers\n"
#~ "alter table line_items\n"
#~ "    add constraint line_itemsFK0 foreign key (product_id) references "
#~ "products\n"
#~ "alter table line_items\n"
#~ "    add constraint line_itemsFK1 foreign key (order_id) references "
#~ "orders]]>"

#~ msgid ""
#~ "<![CDATA[\n"
#~ "        <formula>'HOME'\n"
#~ "    </one-to-one>\n"
#~ "    <one-to-one name=\"mailingAddress\" \n"
#~ "            cascade=\"all\">\n"
#~ "        <formula>name\n"
#~ "        <formula>'MAILING'\n"
#~ "    </one-to-one>\n"
#~ "</class>\n"
#~ "\n"
#~ "<class name=\"Address\" batch-size=\"2\" \n"
#~ "        check=\"addressType in ('MAILING', 'HOME', 'BUSINESS')\">\n"
#~ "    <composite-id>\n"
#~ "        <key-many-to-one name=\"person\" \n"
#~ "                column=\"personName\"/>\n"
#~ "        <key-property name=\"type\" \n"
#~ "                column=\"addressType\"/>\n"
#~ "    </composite-id>\n"
#~ "    <property name=\"street\" type=\"text\"/>\n"
#~ "    <property name=\"state\"/>\n"
#~ "    <property name=\"zip\"/>\n"
#~ "</class>]]>"
#~ msgstr ""
#~ "<![CDATA[\n"
#~ "        <formula>'HOME'\n"
#~ "    </one-to-one>\n"
#~ "    <one-to-one name=\"mailingAddress\" \n"
#~ "            cascade=\"all\">\n"
#~ "        <formula>name\n"
#~ "        <formula>'MAILING'\n"
#~ "    </one-to-one>\n"
#~ "</class>\n"
#~ "\n"
#~ "<class name=\"Address\" batch-size=\"2\" \n"
#~ "        check=\"addressType in ('MAILING', 'HOME', 'BUSINESS')\">\n"
#~ "    <composite-id>\n"
#~ "        <key-many-to-one name=\"person\" \n"
#~ "                column=\"personName\"/>\n"
#~ "        <key-property name=\"type\" \n"
#~ "                column=\"addressType\"/>\n"
#~ "    </composite-id>\n"
#~ "    <property name=\"street\" type=\"text\"/>\n"
#~ "    <property name=\"state\"/>\n"
#~ "    <property name=\"zip\"/>\n"
#~ "</class>]]>"

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

#~ msgid ""
#~ "<![CDATA[\n"
#~ "        </many-to-many>\n"
#~ "    </set>\n"
#~ "</class>\n"
#~ "    \n"
#~ "<class name=\"Group\" table=\"`Group`\">\n"
#~ "    <composite-id>\n"
#~ "        <key-property name=\"name\"/>\n"
#~ "        <key-property name=\"org\"/>\n"
#~ "    </composite-id>\n"
#~ "    <property name=\"description\"/>\n"
#~ "    <set name=\"users\" table=\"UserGroup\" inverse=\"true\">\n"
#~ "        <key>\n"
#~ "            <column name=\"groupName\"/>\n"
#~ "            <column name=\"org\"/>\n"
#~ "        </key>\n"
#~ "        <many-to-many class=\"User\">\n"
#~ "            <column name=\"userName\"/>\n"
#~ "            <formula>org\n"
#~ "        </many-to-many>\n"
#~ "    </set>\n"
#~ "</class>\n"
#~ "]]>"
#~ msgstr ""
#~ "<![CDATA[\n"
#~ "        </many-to-many>\n"
#~ "    </set>\n"
#~ "</class>\n"
#~ "    \n"
#~ "<class name=\"Group\" table=\"`Group`\">\n"
#~ "    <composite-id>\n"
#~ "        <key-property name=\"name\"/>\n"
#~ "        <key-property name=\"org\"/>\n"
#~ "    </composite-id>\n"
#~ "    <property name=\"description\"/>\n"
#~ "    <set name=\"users\" table=\"UserGroup\" inverse=\"true\">\n"
#~ "        <key>\n"
#~ "            <column name=\"groupName\"/>\n"
#~ "            <column name=\"org\"/>\n"
#~ "        </key>\n"
#~ "        <many-to-many class=\"User\">\n"
#~ "            <column name=\"userName\"/>\n"
#~ "            <formula>org\n"
#~ "        </many-to-many>\n"
#~ "    </set>\n"
#~ "</class>\n"
#~ "]]>"

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

#~ msgid ""
#~ "<![CDATA["
#~ msgstr ""
#~ "<![CDATA["

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate example_mappings.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.