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

📄 collection_mapping.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 5 页
字号:
#. Tag: programlisting#: collection_mapping.xml:738#, no-c-formatmsgid """<![CDATA[<class name=\"Parent\">\n""    <id name=\"id\" column=\"parent_id\"/>\n""    ....\n""    <map name=\"children\">\n""        <key column=\"parent_id\"\n""            not-null=\"true\"/>\n""        <map-key column=\"name\" \n""            type=\"string\"/>\n""        <one-to-many class=\"Child\"/>\n""    </map>\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""        insert=\"false\"\n""        update=\"false\"\n""        not-null=\"true\"/>\n""</class>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:740#, no-c-formatmsgid """Note that in this mapping, the collection-valued end of the association is ""responsible for updates to the foreign key. TODO: Does this really result in ""some unnecessary update statements?"msgstr """이 매핑에서 그 연관의 콜렉션 값을 가진 끝이 foreign 키에 대한 업데이트 책임""이 있음을 노트하라."#. Tag: title#: collection_mapping.xml:748#, no-c-formatmsgid "Ternary associations"msgstr "Ternary associations(세겹 연관들)"#. Tag: para#: collection_mapping.xml:750#, no-c-formatmsgid """There are three possible approaches to mapping a ternary association. One is ""to use a <literal>Map</literal> with an association as its index:"msgstr """세 겹의 연관을 매핑하는 세 가지 가능한 접근법들이 존재한다. 하나의 접근법은 ""그것의 인덱스로서 연관관계를 가진 <literal>Map</literal>을 사용하는 것이다:"#. Tag: programlisting#: collection_mapping.xml:755#, no-c-formatmsgid """<![CDATA[<map name=\"contracts\">\n""    <key column=\"employer_id\" not-null=\"true\"/>\n""    <map-key-many-to-many column=\"employee_id\" class=\"Employee\"/>\n""    <one-to-many class=\"Contract\"/>\n""</map>]]>"msgstr ""#. Tag: programlisting#: collection_mapping.xml:757#, no-c-formatmsgid """<![CDATA[<map name=\"connections\">\n""    <key column=\"incoming_node_id\"/>\n""    <map-key-many-to-many column=\"outgoing_node_id\" class=\"Node\"/>\n""    <many-to-many column=\"connection_id\" class=\"Connection\"/>\n""</map>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:759#, no-c-formatmsgid """A second approach is to simply remodel the association as an entity class. ""This is the approach we use most commonly."msgstr """두 번째 접근법은 그 연관을 엔티티 클래스로서 단순하게 리모델링 하는 것이다. ""이것은 우리가 가장 공통적으로 사용하는 접근법이다."#. Tag: para#: collection_mapping.xml:764#, no-c-formatmsgid """A final alternative is to use composite elements, which we will discuss ""later."msgstr """마지막 대안은 우리가 나중에 논의하게 될 composite 요소들을 사용하는 것이다."#. Tag: literal#: collection_mapping.xml:771#, no-c-formatmsgid "Using an &lt;idbag&gt;"msgstr "<literal>&lt;idbag&gt;</literal> 사용하기"#. Tag: para#: collection_mapping.xml:773#, no-c-formatmsgid """If you've fully embraced our view that composite keys are a bad thing and ""that entities should have synthetic identifiers (surrogate keys), then you ""might find it a bit odd that the many to many associations and collections ""of values that we've shown so far all map to tables with composite keys! ""Now, this point is quite arguable; a pure association table doesn't seem to ""benefit much from a surrogate key (though a collection of composite values ""<emphasis>might</emphasis>). Nevertheless, Hibernate provides a feature that ""allows you to map many to many associations and collections of values to a ""table with a surrogate key."msgstr """만일 당신이 composite 키들이 나쁜 것이고 엔티티들이 합성 식별자들(대용 키들, ""surrogate keys)을 가져야 한다는 우리의 견해를 전적으로 수용할 경우, 당신은 우""리가 지금까지 보여주었던 값들을 가진 콜렉션들과 many to many 연관들이 모두 ""composite 키들을 가진 테이블들로 매핑된다는 약간 이상한 점을 발견할 수도 있""다! 이제 이 점은 꽤 논의의 여지가 있다; 순수한 연관 테이블은 (비록 composite ""값들을 가진 콜렉션<emphasis>일 수도</emphasis> 있을지라도) 대용 키로부터 많""은 이점을 취하지 않는 것처럼 보인다. 그럼에도 불구하고 Hibernate는 당신이 값""들을 가진 콜렉션들과 many to many 연관들을 대용 키를 가진 테이블로 매핑시키""는 것을 당신에게 허용해주는 특징을 제공한다."#. Tag: para#: collection_mapping.xml:784#, no-c-formatmsgid """The <literal>&lt;idbag&gt;</literal> element lets you map a <literal>List</""literal> (or <literal>Collection</literal>) with bag semantics."msgstr """<literal>&lt;idbag&gt;</literal> 요소는 bag 의미를 가진 <literal>List</""literal>(또는 <literal>Collection</literal>)을 매핑하도록 당신에게 허용해준""다."#. Tag: programlisting#: collection_mapping.xml:789#, no-c-formatmsgid """<![CDATA[<idbag name=\"lovers\" table=\"LOVERS\">\n""    <collection-id column=\"ID\" type=\"long\">\n""        <generator class=\"sequence\"/>\n""    </collection-id>\n""    <key column=\"PERSON1\"/>\n""    <many-to-many column=\"PERSON2\" class=\"Person\" fetch=\"join\"/>\n""</idbag>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:791#, no-c-formatmsgid """As you can see, an <literal>&lt;idbag&gt;</literal> has a synthetic id ""generator, just like an entity class! A different surrogate key is assigned ""to each collection row. Hibernate does not provide any mechanism to discover ""the surrogate key value of a particular row, however."msgstr """당신이 볼 수 있듯이, <literal>&lt;idbag&gt;</literal>은 마치 엔티티 클래스인""양 synthetic id generator(합성 id 생성기)를 갖는다! 다른 대용 키는 각각의 콜""렉션 행에 할당된다. 하지만 Hibernate는 특정 행의 대용 키 값을 발견하는 메커니""즘을 제공하지 않는다."#. Tag: para#: collection_mapping.xml:798#, no-c-formatmsgid """Note that the update performance of an <literal>&lt;idbag&gt;</literal> is ""<emphasis>much</emphasis> better than a regular <literal>&lt;bag&gt;</""literal>! Hibernate can locate individual rows efficiently and update or ""delete them individually, just like a list, map or set."msgstr """<literal>&lt;idbag&gt;</literal>의 업데이트 퍼포먼스는 정규 <literal>&lt;""bag&gt;</literal> 보다 훨씬 좋다는 점을 노트하라! Hibernate는 마치 list, ""map, 또는 set인양, 개별 행들을 효율적으로 위치지울 수 있고 그것들을 개별적으""로 업데이트 하거나 삭제시킬 수 있다."#. Tag: para#: collection_mapping.xml:805#, no-c-formatmsgid """In the current implementation, the <literal>native</literal> identifier ""generation strategy is not supported for <literal>&lt;idbag&gt;</literal> ""collection identifiers."msgstr """현재 구현에서, <literal>native</literal> 식별자 생성 방도는 <literal>&lt;""idbag&gt;</literal> 콜렉션 식별자들에 대해 지원되지 않는다."#. Tag: title#: collection_mapping.xml:829#, no-c-formatmsgid "Collection examples"msgstr "콜렉션 예제들"#. Tag: para#: collection_mapping.xml:831#, no-c-formatmsgid """The previous sections are pretty confusing. So lets look at an example. This ""class:"msgstr "앞의 절들은 꽤 혼동스럽다. 따라서 예제를 살펴보자. 다음 클래스:"#. Tag: programlisting#: collection_mapping.xml:836#, no-c-formatmsgid """<![CDATA[package eg;\n""import java.util.Set;\n""\n""public class Parent {\n""    private long id;\n""    private Set children;\n""\n""    public long getId() { return id; }\n""    private void setId(long id) { this.id=id; }\n""\n""    private Set getChildren() { return children; }\n""    private void setChildren(Set children) { this.children=children; }\n""\n""    ....\n""    ....\n""}]]>"msgstr ""#. Tag: para#: collection_mapping.xml:838#, no-c-formatmsgid """has a collection of <literal>Child</literal> instances. If each child has at ""most one parent, the most natural mapping is a one-to-many association:"msgstr """는 <literal>Child</literal> 인스턴스들을 가진 하나의 콜렉션을 갖고 있다. 만""일 각각의 자식이 최소한 한 개의 부모를 가질 경우, 대부분의 고유한 매핑은 one-""to-many 연관이다:"#. Tag: programlisting#: collection_mapping.xml:844#, no-c-formatmsgid """<![CDATA[<hibernate-mapping>\n""\n""    <class name=\"Parent\">\n""        <id name=\"id\">\n""            <generator class=\"sequence\"/>\n""        </id>\n""        <set name=\"children\">\n""            <key column=\"parent_id\"/>\n""            <one-to-many class=\"Child\"/>\n""        </set>\n""    </class>\n""\n""    <class name=\"Child\">\n""        <id name=\"id\">\n""            <generator class=\"sequence\"/>\n""        </id>\n""        <property name=\"name\"/>\n""    </class>\n""\n""</hibernate-mapping>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:846#, no-c-formatmsgid "This maps to the following table definitions:"msgstr "이것은 다음 테이블 정의들로 매핑된다:"#. Tag: programlisting#: collection_mapping.xml:850#, no-c-formatmsgid """<![CDATA[create table parent ( id bigint not null primary key )\n""create table child ( id bigint not null primary key, name varchar(255), ""parent_id bigint )\n""alter table child add constraint childfk0 (parent_id) references parent]]>"msgstr ""#. Tag: para#: collection_mapping.xml:852#, no-c-formatmsgid """If the parent is <emphasis>required</emphasis>, use a bidirectional one-to-""many association:"msgstr """만일 부모가 <emphasis>필수적</emphasis>이라면, 양방향 one-to-many 연관관계를 ""사용하라:"#. Tag: programlisting#: collection_mapping.xml:857#, no-c-formatmsgid """<![CDATA[<hibernate-mapping>\n""\n""    <class name=\"Parent\">\n""        <id name=\"id\">\n""            <generator class=\"sequence\"/>\n""        </id>\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\">\n""            <generator class=\"sequence\"/>\n""        </id>\n""        <property name=\"name\"/>\n""        <many-to-one name=\"parent\" class=\"Parent\" column=\"parent_id\" ""not-null=\"true\"/>\n""    </class>\n""\n""</hibernate-mapping>]]>"msgstr ""#. Tag: para#: collection_mapping.xml:859#, no-c-formatmsgid "Notice the <literal>NOT NULL</literal> constraint:"msgstr "<literal>NOT NULL</literal> 컨스트레인트를 주목하라:"#. Tag: programlisting#: collection_mapping.xml:863#, no-c-formatmsgid """<

⌨️ 快捷键说明

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