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

📄 collection_mapping.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 5 页
字号:
#. Tag: title#: collection_mapping.xml:600#, no-c-formatmsgid "Advanced collection mappings"msgstr "高度なコレクション・マッピング"#. Tag: title#: collection_mapping.xml:603#, no-c-formatmsgid "Sorted collections"msgstr "ソートされたコレクション"#. Tag: para#: collection_mapping.xml:605#, no-c-formatmsgid """Hibernate supports collections implementing <literal>java.util.SortedMap</""literal> and <literal>java.util.SortedSet</literal>. You must specify a ""comparator in the mapping file:"msgstr """Hibernateは <literal>java.util.SortedMap</literal> と <literal>java.util.""SortedSet</literal> を実装したコレクションをサポートしています。 開発者はマッ""ピング定義ファイルにコンパレータを指定しなければなりません。"#. Tag: programlisting#: collection_mapping.xml:610#, no-c-formatmsgid """<![CDATA[<set name=\"aliases\" \n""            table=\"person_aliases\" \n""            sort=\"natural\">\n""    <key column=\"person\"/>\n""    <element column=\"name\" type=\"string\"/>\n""</set>\n""\n""<map name=\"holidays\" sort=\"my.custom.HolidayComparator\">\n""    <key column=\"year_id\"/>\n""    <map-key column=\"hol_name\" type=\"string\"/>\n""    <element column=\"hol_date\" type=\"date\"/>\n""</map>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:612#, no-c-formatmsgid """Allowed values of the <literal>sort</literal> attribute are ""<literal>unsorted</literal>, <literal>natural</literal> and the name of a ""class implementing <literal>java.util.Comparator</literal>."msgstr """<literal>sort</literal> 属性に設定できる値は <literal>unsorted</literal> と ""<literal>natural</literal> および、<literal>java.util.Comparator</literal> を""実装したクラスの名前です。"#. Tag: para#: collection_mapping.xml:618#, no-c-formatmsgid """Sorted collections actually behave like <literal>java.util.TreeSet</literal> ""or <literal>java.util.TreeMap</literal>."msgstr """ソートされたコレクションは実質的には <literal>java.util.TreeSet</literal> や ""<literal>java.util.TreeMap</literal> のように振舞います。"#. Tag: para#: collection_mapping.xml:623#, no-c-formatmsgid """If you want the database itself to order the collection elements use the ""<literal>order-by</literal> attribute of <literal>set</literal>, ""<literal>bag</literal> or <literal>map</literal> mappings. This solution is ""only available under JDK 1.4 or higher (it is implemented using ""<literal>LinkedHashSet</literal> or <literal>LinkedHashMap</literal>). This ""performs the ordering in the SQL query, not in memory."msgstr """もしデータベース自身にコレクションの要素を並べさせたいなら、 <literal>set</""literal> や <literal>bag</literal>、<literal>map</literal> の <literal>order-""by</literal> 属性を使います。 この解決法はJDK1.4、もしくはそれ以上のバージョ""ンで利用可能です (<literal>LinkedHashSet</literal> または ""<literal>LinkedHashMap</literal>を使って実装されています)。 整列はメモリ上で""はなく、SQLクエリ内で実行されます。"#. Tag: programlisting#: collection_mapping.xml:632#, no-c-formatmsgid """<![CDATA[<set name=\"aliases\" table=\"person_aliases\" order-by=\"lower""(name) asc\">\n""    <key column=\"person\"/>\n""    <element column=\"name\" type=\"string\"/>\n""</set>\n""\n""<map name=\"holidays\" order-by=\"hol_date, hol_name\">\n""    <key column=\"year_id\"/>\n""    <map-key column=\"hol_name\" type=\"string\"/>\n""    <element column=\"hol_date type=\"date\"/>\n""</map>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:634#, no-c-formatmsgid """Note that the value of the <literal>order-by</literal> attribute is an SQL ""ordering, not a HQL ordering!"msgstr """<literal>order-by</literal> 属性の値がSQL命令であって、HQL命令ではないことに""注意してください!"#. Tag: para#: collection_mapping.xml:639#, no-c-formatmsgid """Associations may even be sorted by some arbitrary criteria at runtime using ""a collection <literal>filter()</literal>."msgstr """関連は、コレクションの <literal>filter()</literal> を使うことで、 実行時に任""意のcriteriaによってソートすることも可能です。"#. Tag: programlisting#: collection_mapping.xml:644#, no-c-formatmsgid """<![CDATA[sortedUsers = s.createFilter( group.getUsers(), \"order by this.name""\" ).list();]]>"msgstr ""#. Tag: title#: collection_mapping.xml:649#, no-c-formatmsgid "Bidirectional associations"msgstr "双方向関連"#. Tag: para#: collection_mapping.xml:651#, fuzzy, no-c-formatmsgid """A <emphasis>bidirectional association</emphasis> allows navigation from both ""\"ends\" of the association. Two kinds of bidirectional association are ""supported:"msgstr """<emphasis>双方向関連</emphasis> は関連のどちら「側」からでもナビゲーションで""きます。 2種類の双方向関連がサポートされています。 <placeholder-1/>"#. Tag: term#: collection_mapping.xml:658#, no-c-formatmsgid "one-to-many"msgstr "one-to-many"#. Tag: para#: collection_mapping.xml:660#, no-c-formatmsgid "set or bag valued at one end, single-valued at the other"msgstr "片側がsetかbag、もう片方が単一値です。"#. Tag: term#: collection_mapping.xml:666#, no-c-formatmsgid "many-to-many"msgstr "many-to-many"#. Tag: para#: collection_mapping.xml:668#, no-c-formatmsgid "set or bag valued at both ends"msgstr "両側がsetかbagです。"#. Tag: para#: collection_mapping.xml:677#, no-c-formatmsgid """You may specify a bidirectional many-to-many association simply by mapping ""two many-to-many associations to the same database table and declaring one ""end as <emphasis>inverse</emphasis> (which one is your choice, but it can ""not be an indexed collection)."msgstr """2つの多対多関連で同じデータベーステーブルをマッピングし、 片方を ""<emphasis>inverse</emphasis> として宣言することで、 双方向の多対多関連を指定""することが出来ます (どちらをinverseに選んだとしても、そちら側にはインデック""ス付きのコレクションは使えません)。"#. Tag: para#: collection_mapping.xml:684#, no-c-formatmsgid """Here's an example of a bidirectional many-to-many association; each category ""can have many items and each item can be in many categories:"msgstr """次に双方向の多対多関連の例を示します。 各カテゴリは多数のアイテムを持つことが""でき、各アイテムは多くのカテゴリに属することが出来ます。"#. Tag: programlisting#: collection_mapping.xml:689#, no-c-formatmsgid """<![CDATA[<class name=\"Category\">\n""    <id name=\"id\" column=\"CATEGORY_ID\"/>\n""    ...\n""    <bag name=\"items\" table=\"CATEGORY_ITEM\">\n""        <key column=\"CATEGORY_ID\"/>\n""        <many-to-many class=\"Item\" column=\"ITEM_ID\"/>\n""    </bag>\n""</class>\n""\n""<class name=\"Item\">\n""    <id name=\"id\" column=\"ITEM_ID\"/>\n""    ...\n""\n""    <!-- inverse end -->\n""    <bag name=\"categories\" table=\"CATEGORY_ITEM\" inverse=\"true\">\n""        <key column=\"ITEM_ID\"/>\n""        <many-to-many class=\"Category\" column=\"CATEGORY_ID\"/>\n""    </bag>\n""</class>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:691#, no-c-formatmsgid """Changes made only to the inverse end of the association are <emphasis>not</""emphasis> persisted. This means that Hibernate has two representations in ""memory for every bidirectional association, one link from A to B and another ""link from B to A. This is easier to understand if you think about the Java ""object model and how we create a many-to-many relationship in Java:"msgstr """関連のinverse側にのみ行われた変更は永続化 <emphasis>されません</emphasis>。 ""これは、Hibernateは全ての双方向関連について、メモリ上に2つの表現を持っている""という意味です。 つまり一つはAからBへのリンクで、もう一つはBからAへのリンクと""いうことです。 Javaのオブジェクトモデルについて考え、Javaで双方向関係をどう""やって作るかを考えれば、 これは理解しやすいです。下記に、Javaでの双方向関連を""示します。"#. Tag: programlisting#: collection_mapping.xml:699#, no-c-formatmsgid """<![CDATA[\n""category.getItems().add(item);          // The category now \"knows\" about ""the relationship\n""item.getCategories().add(category);     // The item now \"knows\" about the ""relationship\n""\n""session.persist(item);                   // The relationship won't be ""saved!\n""session.persist(category);               // The relationship will be saved]]>"msgstr ""#. Tag: para#: collection_mapping.xml:701#, no-c-formatmsgid """The non-inverse side is used to save the in-memory representation to the ""database."msgstr """関連のinverseではない側は、メモリ上の表現をデータベースに保存するのに使われま""す。"#. Tag: para#: collection_mapping.xml:705#, no-c-formatmsgid """You may define a bidirectional one-to-many association by mapping a one-to-""many association to the same table column(s) as a many-to-one association ""and declaring the many-valued end <literal>inverse=\"true\"</literal>."msgstr """双方向の一対多関連を定義するには、 一対多関連を多対一関連と同じテーブルのカラ""ムにマッピングし、 多側に <literal>inverse=\"true\"</literal> と宣言します。"#. Tag: programlisting#: collection_mapping.xml:711#, no-c-formatmsgid """<![CDATA[<class name=\"Parent\">\n""    <id name=\"id\" column=\"parent_id\"/>\n""    ....\n""    <set name=\"children\" inverse=\"true\">\n""        <key column=\"parent_id\"/>\n""        <one-to-many class=\"Child\"/>\n""    </set>\n""</class>\n""\n""<class name=\"Child\">\n""    <id name=\"id\" column=\"child_id\"/>\n""    ....\n""    <many-to-one name=\"parent\" \n""        class=\"Parent\" \n""        column=\"parent_id\"\n""        not-null=\"true\"/>\n""</class>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:713#, no-c-formatmsgid """Mapping one end of an association with <literal>inverse=\"true\"</literal> ""doesn't affect the operation of cascades, these are orthogonal concepts!"msgstr """関連の片側に <literal>inverse=\"true\"</literal> を設定しても、 カスケード操""作に影響を与えません。これらは直交した概念です!"#. Tag: title#: collection_mapping.xml:721#, no-c-formatmsgid "Bidirectional associations with indexed collections"msgstr "インデックス付きコレクションと双方向関連"#. Tag: para#: collection_mapping.xml:722#, no-c-formatmsgid """A bidirectional association where one end is represented as a <literal>&lt;""list&gt;</literal> or <literal>&lt;map&gt;</literal> requires special ""consideration. If there is a property of the child class which maps to the ""index column, no problem, we can continue using <literal>inverse=\"true\"</""literal> on the collection mapping:"msgstr ""

⌨️ 快捷键说明

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