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

📄 association_mapping.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 2 页
字号:
"\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:141 association_mapping.xml:246#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key )\n""create table PersonAddress ( personId bigint not null, addressId bigint not ""null, primary key (personId, addressId) )\n""create table Address ( addressId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: title#: association_mapping.xml:148#, no-c-formatmsgid "Bidirectional associations"msgstr "양방향 연관들"#. Tag: title#: association_mapping.xml:151 association_mapping.xml:211#, no-c-formatmsgid "one to many / many to one"msgstr "one to many / many to one"#. Tag: para#: association_mapping.xml:153#, no-c-formatmsgid """A <emphasis>bidirectional many-to-one association</emphasis> is the most ""common kind of association. (This is the standard parent/child relationship.)"msgstr """<emphasis>양방향 many-to-one 연관</emphasis>은 가장 공통된 종류의 연관이다.""(이것은 표준 부모/자식 관계이다. )"#. Tag: programlisting#: association_mapping.xml:159#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <many-to-one name=\"address\" \n""        column=\"addressId\"\n""        not-null=\"true\"/>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <set name=\"people\" inverse=\"true\">\n""        <key column=\"addressId\"/>\n""        <one-to-many class=\"Person\"/>\n""    </set>\n""</class>]]>"msgstr ""#. Tag: para#: association_mapping.xml:163#, no-c-formatmsgid """If you use a <literal>List</literal> (or other indexed collection) you need ""to set the <literal>key</literal> column of the foreign key to <literal>not ""null</literal>, and let Hibernate manage the association from the ""collections side to maintain the index of each element (making the other ""side virtually inverse by setting <literal>update=\"false\"</literal> and ""<literal>insert=\"false\"</literal>):"msgstr """만일 당신이 <literal>List</literal>(또는 다른 인덱싱 된 콜렉션)을 사용할 경""우 당신은 foreign key의 <literal>key</literal> 컬럼을 <literal>not null</""literal>로 설정하고, Hibernate로 하여금 각각의 요소의 인덱스를 유지관리하기 ""위해 (<literal>update=\"false\"</literal>와 <literal>insert=\"false\"</""literal>를 설정함으로써 다른 측을 가상적으로 inverse로 만들어) 그 콜렉션들 측""으로부터 연관을 관리하도록 할 필요가 있다:"#. Tag: programlisting#: association_mapping.xml:171#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""   <id name=\"id\"/>\n""   ...\n""   <many-to-one name=\"address\"\n""      column=\"addressId\"\n""      not-null=\"true\"\n""      insert=\"false\"\n""      update=\"false\"/>\n""</class>\n""\n""<class name=\"Address\">\n""   <id name=\"id\"/>\n""   ...\n""   <list name=\"people\">\n""      <key column=\"addressId\" not-null=\"true\"/>\n""      <list-index column=\"peopleIdx\"/>\n""      <one-to-many class=\"Person\"/>\n""   </list>\n""</class>]]>"msgstr ""#. Tag: para#: association_mapping.xml:173#, no-c-formatmsgid """It is important that you define <literal>not-null=\"true\"</literal> on the ""<literal>&lt;key&gt;</literal> element of the collection mapping if the ""underlying foreign key column is <literal>NOT NULL</literal>. Don't only ""declare <literal>not-null=\"true\"</literal> on a possible nested ""<literal>&lt;column&gt;</literal> element, but on the <literal>&lt;key&gt;</""literal> element."msgstr """만일 기본 외래 키 컬럼이 <literal>NOT NULL</literal>일 경우 콜렉션 매핑의 ""<literal>&lt;key&gt;</literal> 요소 상에 <literal>not-null=\"true\"</literal>""를 정의하는 것이 중요하다. 내포된 <literal>&lt;column&gt;</literal> 요소 상""에 <literal>not-null=\"true\"</literal>를 선언하지 말고, <literal>&lt;key&gt;""</literal> 요소 상에 선언하라."#. Tag: para#: association_mapping.xml:187#, no-c-formatmsgid """A <emphasis>bidirectional one-to-one association on a foreign key</emphasis> ""is quite common."msgstr """<emphasis>foreign에 대한 양방향 one-to-one 연관</emphasis>은 꽤 공통적이다."#. Tag: programlisting#: association_mapping.xml:192#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <many-to-one name=\"address\" \n""        column=\"addressId\" \n""        unique=\"true\"\n""        not-null=\"true\"/>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""   <one-to-one name=\"person\" \n""        property-ref=\"address\"/>\n""</class>]]>"msgstr ""#. Tag: para#: association_mapping.xml:195#, no-c-formatmsgid """A <emphasis>bidirectional one-to-one association on a primary key</emphasis> ""uses the special id generator."msgstr """<emphasis>하나의 프라이머리 키에 대한 양방향 one-to-one 연관</emphasis>은 특""별한 id 생성기를 사용한다."#. Tag: programlisting#: association_mapping.xml:200#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <one-to-one name=\"address\"/>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"foreign\">\n""            <param name=\"property\">person</param>\n""        </generator>\n""    </id>\n""    <one-to-one name=\"person\" \n""        constrained=\"true\"/>\n""</class>]]>"msgstr ""#. Tag: title#: association_mapping.xml:208#, no-c-formatmsgid "Bidirectional associations with join tables"msgstr "join 테이블들에 대한 양방향 연관들"#. Tag: para#: association_mapping.xml:213#, no-c-formatmsgid """A <emphasis>bidirectional one-to-many association on a join table</""emphasis>. Note that the <literal>inverse=\"true\"</literal> can go on ""either end of the association, on the collection, or on the join."msgstr """<emphasis>하나의 join 테이블에 대한 양방향 one-to-many 연관</emphasis>. ""<literal>inverse=\"true\"</literal>는 연관의 어느 쪽 끝이든 콜렉션 측으로 또""는 join 측으로 갈 수 있다."#. Tag: programlisting#: association_mapping.xml:219#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <set name=\"addresses\" \n""        table=\"PersonAddress\">\n""        <key column=\"personId\"/>\n""        <many-to-many column=\"addressId\"\n""            unique=\"true\"\n""            class=\"Address\"/>\n""    </set>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <join table=\"PersonAddress\" \n""        inverse=\"true\" \n""        optional=\"true\">\n""        <key column=\"addressId\"/>\n""        <many-to-one name=\"person\"\n""            column=\"personId\"\n""            not-null=\"true\"/>\n""    </join>\n""</class>]]>"msgstr ""#. Tag: programlisting#: association_mapping.xml:220#, no-c-formatmsgid """<![CDATA[\n""create table Person ( personId bigint not null primary key )\n""create table PersonAddress ( personId bigint not null, addressId bigint not ""null primary key )\n""create table Address ( addressId bigint not null primary key )\n""        ]]>"msgstr ""#. Tag: para#: association_mapping.xml:227#, no-c-formatmsgid """A <emphasis>bidirectional one-to-one association on a join table</emphasis> ""is extremely unusual, but possible."msgstr """<emphasis>하나의 join 테이블에 대한 양방향 one-to-one 연관</emphasis>은 극히 ""통상적이지 않지만, 가능하다."#. Tag: programlisting#: association_mapping.xml:232#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <join table=\"PersonAddress\" \n""        optional=\"true\">\n""        <key column=\"personId\" \n""            unique=\"true\"/>\n""        <many-to-one name=\"address\"\n""            column=\"addressId\" \n""            not-null=\"true\"\n""            unique=\"true\"/>\n""    </join>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <join table=\"PersonAddress\" \n""        optional=\"true\"\n""        inverse=\"true\">\n""        <key column=\"addressId\" \n""            unique=\"true\"/>\n""        <many-to-one name=\"person\"\n""            column=\"personId\" \n""            not-null=\"true\"\n""            unique=\"true\"/>\n""    </join>\n""</class>]]>"msgstr ""#. Tag: para#: association_mapping.xml:240#, no-c-formatmsgid """Finally, we have a <emphasis>bidirectional many-to-many association</""emphasis>."msgstr """마지막으로, 우리는 하나의 <emphasis>양방향 many-to-many 연관</emphasis>을 갖""는다."#. Tag: programlisting#: association_mapping.xml:244#, no-c-formatmsgid """<![CDATA[<class name=\"Person\">\n""    <id name=\"id\" column=\"personId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <set name=\"addresses\" table=\"PersonAddress\">\n""        <key column=\"personId\"/>\n""        <many-to-many column=\"addressId\"\n""            class=\"Address\"/>\n""    </set>\n""</class>\n""\n""<class name=\"Address\">\n""    <id name=\"id\" column=\"addressId\">\n""        <generator class=\"native\"/>\n""    </id>\n""    <set name=\"people\" inverse=\"true\" table=\"PersonAddress\">\n""        <key column=\"addressId\"/>\n""        <many-to-many column=\"personId\"\n""            class=\"Person\"/>\n""    </set>\n""</class>]]>"msgstr ""#. Tag: title#: association_mapping.xml:253#, no-c-formatmsgid "More complex association mappings"msgstr "보다 복잡한 연관 매핑들"#. Tag: para#: association_mapping.xml:255#, no-c-formatmsgid """More complex association joins are <emphasis>extremely</emphasis> rare. ""Hibernate makes it possible to handle more complex situations using SQL ""fragments embedded in the mapping document. For example, if a table with ""historical account information data defines <literal>accountNumber</""literal>, <literal>effectiveEndDate</literal> and ""<literal>effectiveStartDate</literal>columns, mapped as follows:"msgstr """보다 복잡한 연관 조인들은 <emphasis>극기</emphasis> 드물다. Hibernate는 매핑 ""문서들 내에 삽입된 SQL 조각들을 사용하여 보다 복잡한 상황을 처리하는 것을 가""능하도록 해준다. 예를 들어, 만일 계좌 내역 정보 데이터를 가진 하나이 테이블""이 <literal>accountNumber</literal>, <literal>effectiveEndDate</literal> 그리""고 <literal>effectiveStartDate</literal> 컬럼들을 정의할 경우, 다음과 같이 매""핑된다:"#. Tag: programlisting#: association_mapping.xml:264#, no-c-formatmsgid """<![CDATA[<properties name=\"currentAccountKey\">\n""    <property name=\"accountNumber\" type=\"string\" not-null=\"true\"/>\n""    <property name=\"currentAccount\" type=\"boolean\">\n""        <formula>case when effectiveEndDate is null then 1 else 0 end</""formula>\n""    </property>\n""</properties>\n""<property name=\"effectiveEndDate\" type=\"date\"/>\n""<property name=\"effectiveStateDate\" type=\"date\" not-null=\"true\"/>]]>"msgstr ""#. Tag: para#: association_mapping.xml:266#, no-c-formatmsgid """Then we can map an association to the <emphasis>current</emphasis> instance ""(the one with null <literal>effectiveEndDate</literal>) using:"msgstr """그때 우리는 다음을 사용하여 하나의 연관을 <emphasis>현재</emphasis> 인스턴스 ""(null <literal>effectiveEndDate</literal>을 가진 인스턴스)로 매핑시킬 수 있""다:"#. Tag: programlisting#: association_mapping.xml:271#, no-c-formatmsgid """<![CDATA[<many-to-one name=\"currentAccountInfo\" \n""        property-ref=\"currentAccountKey\"\n""        class=\"AccountInfo\">\n""    <column name=\"accountNumber\"/>\n""    <formula>'1'</formula>\n""</many-to-one>]]>"msgstr ""#. Tag: para#: association_mapping.xml:273#, no-c-formatmsgid """In a more complex example, imagine that the association between ""<literal>Employee</literal> and <literal>Organization</literal> is ""maintained in an <literal>Employment</literal> table full of historical ""employment data. Then an association to the employee's <emphasis>most ""recent</emphasis> employer (the one with the most recent <literal>startDate</""literal>) might be mapped this way:"msgstr """보다 복잡한 예제에서, <literal>Employee</literal>와 <literal>Organization</""literal> 사이의 연관이 전체 고용 내역 데이터를 가진 <literal>Employment</""literal> 테이블 내에 유지된다고 가정하자. 그때 종업원의 <emphasis>가장 최근의""</emphasis> 고용주에 대한 하나의 연관(가장 최근의 <literal>startDate</""literal>를 갖고 있는 것)이 다음 방법으로 매핑될 수 있다:"#. Tag: programlisting#: association_mapping.xml:281#, no-c-formatmsgid """<![CDATA[<join>\n""    <key column=\"employeeId\"/>\n""    <subselect>\n""        select employeeId, orgId \n""        from Employments \n""        group by orgId \n""        having startDate = max(startDate)\n""    </subselect>\n""    <many-to-one name=\"mostRecentEmployer\" \n""            class=\"Organization\" \n""            column=\"orgId\"/>\n""</join>]]>"msgstr ""#. Tag: para#: association_mapping.xml:283#, no-c-formatmsgid """You can get quite creative with this functionality, but it is usually more ""practical to handle these kinds of cases using HQL or a criteria query."msgstr """당신은 이 기능으로 아주 생산성을 얻을 수 있지만, 그것은 대개 HQL 또는 ""criteria 질의를 사용하여 이들 종류의 경우들을 처리하는 것이 보다 실용적이다."

⌨️ 快捷键说明

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