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

Hibernate example source code file (association_mapping.pot)

This example Hibernate source code file (association_mapping.pot) 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, a, for, hibernate, if, in, in, more, tag, tag, the, the, unidirectional, you

The Hibernate association_mapping.pot source code

# 
# AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: 0\n"
"POT-Creation-Date: 2010-03-31T00:33:04\n"
"PO-Revision-Date: 2010-03-31T00:33:04\n"
"Last-Translator: Automatically generated\n"
"Language-Team: None\n"
"MIME-Version: 1.0\n"
"Content-Type: application/x-publican; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Tag: title
#, no-c-format
msgid "Association Mappings"
msgstr ""

#. Tag: title
#, no-c-format
msgid "Introduction"
msgstr ""

#. Tag: para
#, no-c-format
msgid "Association mappings are often the most difficult thing to implement correctly. In this section we examine some canonical cases one by one, starting with unidirectional mappings and then bidirectional cases. We will use <literal>Person and Address in all the examples."
msgstr ""

#. Tag: para
#, no-c-format
msgid "Associations will be classified by multiplicity and whether or not they map to an intervening join table."
msgstr ""

#. Tag: para
#, no-c-format
msgid "Nullable foreign keys are not considered to be good practice in traditional data modelling, so our examples do not use nullable foreign keys. This is not a requirement of Hibernate, and the mappings will work if you drop the nullability constraints."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Unidirectional associations"
msgstr ""

#. Tag: title
#, no-c-format
msgid "Many-to-one"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>unidirectional many-to-one association is the most common kind of unidirectional association."
msgstr ""

#. Tag: title
#, no-c-format
msgid "One-to-one"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>unidirectional one-to-one association on a foreign key is almost identical. The only difference is the column unique constraint."
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>unidirectional one-to-one association on a primary key usually uses a special id generator In this example, however, we have reversed the direction of the association:"
msgstr ""

#. Tag: title
#, no-c-format
msgid "One-to-many"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>unidirectional one-to-many association on a foreign key is an unusual case, and is not recommended."
msgstr ""

#. Tag: para
#, no-c-format
msgid "You should instead use a join table for this kind of association."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Unidirectional associations with join tables"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>unidirectional one-to-many association on a join table is the preferred option. Specifying unique=\"true\", changes the multiplicity from many-to-many to one-to-many."
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>unidirectional many-to-one association on a join table is common when the association is optional. For example:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>unidirectional one-to-one association on a join table is possible, but extremely unusual."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Many-to-many"
msgstr ""

#. Tag: para
#, no-c-format
msgid "Finally, here is an example of a <emphasis>unidirectional many-to-many association."
msgstr ""

#. Tag: title
#, no-c-format
msgid "Bidirectional associations"
msgstr ""

#. Tag: title
#, no-c-format
msgid "one-to-many / many-to-one"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>bidirectional many-to-one association is the most common kind of association. The following example illustrates the standard parent/child relationship."
msgstr ""

#. Tag: para
#, no-c-format
msgid "If you use a <literal>List, or other indexed collection, set the key column of the foreign key to not null. Hibernate will manage the association from the collections side to maintain the index of each element, making the other side virtually inverse by setting update=\"false\" and insert=\"false\":"
msgstr ""

#. Tag: para
#, no-c-format
msgid "If the underlying foreign key column is <literal>NOT NULL, it is important that you define not-null=\"true\" on the <key> element of the collection mapping. Do not only declare not-null=\"true\" on a possible nested <column> element, but on the <key> element."
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>bidirectional one-to-one association on a foreign key is common:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>bidirectional one-to-one association on a primary key uses the special id generator:"
msgstr ""

#. Tag: title
#, no-c-format
msgid "Bidirectional associations with join tables"
msgstr ""

#. Tag: para
#, no-c-format
msgid "The following is an example of a <emphasis>bidirectional one-to-many association on a join table. The inverse=\"true\" can go on either end of the association, on the collection, or on the join."
msgstr ""

#. Tag: title
#, no-c-format
msgid "one to one"
msgstr ""

#. Tag: para
#, no-c-format
msgid "A <emphasis>bidirectional one-to-one association on a join table is possible, but extremely unusual."
msgstr ""

#. Tag: para
#, no-c-format
msgid "Here is an example of a <emphasis>bidirectional many-to-many association."
msgstr ""

#. Tag: title
#, no-c-format
msgid "More complex association mappings"
msgstr ""

#. Tag: para
#, no-c-format
msgid "More complex association joins are <emphasis>extremely rare. Hibernate handles more complex situations by using SQL fragments embedded in the mapping document. For example, if a table with historical account information data defines accountNumber, effectiveEndDate and effectiveStartDatecolumns, it would be mapped as follows:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "You can then map an association to the <emphasis>current instance, the one with null effectiveEndDate, by using:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "In a more complex example, imagine that the association between <literal>Employee and Organization is maintained in an Employment table full of historical employment data. An association to the employee's most recent employer, the one with the most recent startDate, could be mapped in the following way:"
msgstr ""

#. Tag: para
#, no-c-format
msgid "This functionality allows a degree of creativity and flexibility, but it is more practical to handle these kinds of cases using HQL or a criteria query."
msgstr ""

Other Hibernate examples (source code examples)

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

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

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 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.