📄 example_parentchild.po
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 07:47+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: example_parentchild.xml:5#, no-c-formatmsgid "Example: Parent/Child"msgstr "예제: 부모/자식"#. Tag: para#: example_parentchild.xml:7#, no-c-formatmsgid """One of the very first things that new users try to do with Hibernate is to ""model a parent / child type relationship. There are two different approaches ""to this. For various reasons the most convenient approach, especially for ""new users, is to model both <literal>Parent</literal> and <literal>Child</""literal> as entity classes with a <literal><one-to-many></literal> ""association from <literal>Parent</literal> to <literal>Child</literal>. (The ""alternative approach is to declare the <literal>Child</literal> as a ""<literal><composite-element></literal>.) Now, it turns out that ""default semantics of a one to many association (in Hibernate) are much less ""close to the usual semantics of a parent / child relationship than those of ""a composite element mapping. We will explain how to use a ""<emphasis>bidirectional one to many association with cascades</emphasis> to ""model a parent / child relationship efficiently and elegantly. It's not at ""all difficult!"msgstr """새로운 사용자들이 Hibernate로 행하고자 시도하는 바로 첫 번째 것들 중 하나는 ""부모/자식 타입의 관계를 모형화 시키는 것이다. 이것에 대한 두 가지 다른 접근법""들이 존재한다. 여러가지 이유들로 인해 특히 새로운 사용자들에게 가장 편한 접근""법은 <literal>Parent</literal>로부터 <literal>Child</literal>로의 ""<literal><one-to-many></literal> 연관을 가진 엔티티 클래스들로서 ""<literal>Parent</literal>와 <literal>Child</literal> 양자를 모형화 시키는 것""이다. (다른 접근법은 <literal>Child</literal>를 <literal><composite-""element></literal>로 선언하는 것이다.) 이제, (Hibernate에서) one to many ""연관에 대한 디폴트 의미는 composite 요소 매핑의 의미보다 부모/자식 관계의 통""상적인 의미에 훨씬 덜 가깝다는 것이 판명된다. 우리는 부모/자식 관계를 효율적""이고 강력하게 모형화 시키기 위해 <emphasis>케스케이드들을 가진 양방향 one to ""many 연관</emphasis>을 사용하는 방법을 설명할 것이다. 그것은 전혀 어렵지 않""다!"#. Tag: title#: example_parentchild.xml:21#, no-c-formatmsgid "A note about collections"msgstr "콜렉션들에 관한 노트"#. Tag: para#: example_parentchild.xml:23#, no-c-formatmsgid """Hibernate collections are considered to be a logical part of their owning ""entity; never of the contained entities. This is a crucial distinction! It ""has the following consequences:"msgstr """Hibernate 콜렉션들은 그것들의 소유하고 있는 엔티티의 논리적 부분으로 간주된""다; 결코 포함된 엔티티들의 부분이 아니다. 이것은 중대한 구분점이다! 그것은 다""음은 다음 결과들을 갖는다:"#. Tag: para#: example_parentchild.xml:30#, no-c-formatmsgid """When we remove / add an object from / to a collection, the version number of ""the collection owner is incremented."msgstr """콜렉션으로부터 객체를 제거하고/콜렉션에 객체를 추가 시킬 때, 콜렉션 소유자의 ""버전 번호가 증가된다."#. Tag: para#: example_parentchild.xml:36#, no-c-formatmsgid """If an object that was removed from a collection is an instance of a value ""type (eg, a composite element), that object will cease to be persistent and ""its state will be completely removed from the database. Likewise, adding a ""value type instance to the collection will cause its state to be immediately ""persistent."msgstr """만일 콜렉션으로부터 제거되었던 객체가 하나의 값 타입의 인스턴스(예를 들어 ""composite 요소)이면, 그 객체는 영속상태를 끝내고 그것의 상태가 데이터베이스로""부터 완전히 제거될 것이다. 마찬가지로 하나의 값 타입의 인스턴스를 콜렉션에 추""가시키는 것은 그것의 상태가 즉시 영속화 되도록 강제시킬 것이다."#. Tag: para#: example_parentchild.xml:44#, no-c-formatmsgid """On the other hand, if an entity is removed from a collection (a one-to-many ""or many-to-many association), it will not be deleted, by default. This ""behaviour is completely consistent - a change to the internal state of ""another entity should not cause the associated entity to vanish! Likewise, ""adding an entity to a collection does not cause that entity to become ""persistent, by default."msgstr """반면에, 만일 엔티티가 콜렉션으로부터 제거될 경우(one-to-many 또는 many-to-""many 연관), 그것은 디폴트로 삭제되지 않을 것이다. 이 특징은 완전하게 일관적이""다 - 다른 엔티티의 내부 상태에 대한 변경은 연관된 엔티티를 사라지도록 강제하""지 않을 것이다! 마찬가지로 콜렉션에 엔티티를 추가시키는 것은 디폴트로 그 엔티""티가 영속화 되도록 강제시키지 않는다."#. Tag: para#: example_parentchild.xml:54#, no-c-formatmsgid """Instead, the default behaviour is that adding an entity to a collection ""merely creates a link between the two entities, while removing it removes ""the link. This is very appropriate for all sorts of cases. Where it is not ""appropriate at all is the case of a parent / child relationship, where the ""life of the child is bound to the life cycle of the parent."msgstr """대신에 콜렉션으로의 엔티티 추가가 두 엔티티들 사이에 단지 하나의 링크를 생성""시키는 반면에, 그것을 제거하는 것은 링크를 제거한다는 점이 디폴트 특징이다. ""이것은 모든 종류의 경우들에 대해 매우 적절하다. 그것이 전혀 적절하지 않은 곳""은 부모/자식 관계인 경우이고, 여기서 자식의 생애는 부모의 생명주기에 묶여져 ""있다."#. Tag: title#: example_parentchild.xml:64#, no-c-formatmsgid "Bidirectional one-to-many"msgstr "양방향 one-to-many"#. Tag: para#: example_parentchild.xml:66#, no-c-formatmsgid """Suppose we start with a simple <literal><one-to-many></literal> ""association from <literal>Parent</literal> to <literal>Child</literal>."msgstr """<literal>Parent</literal>로부터 <literal>Child</literal>로의 간단한 ""<literal><one-to-many></literal> 연관관계로 시작한다고 가정하자."#. Tag: programlisting#: example_parentchild.xml:71#, no-c-formatmsgid """<![CDATA[<set name=\"children\">\n"" <key column=\"parent_id\"/>\n"" <one-to-many class=\"Child\"/>\n""</set>]]>"msgstr ""#. Tag: para#: example_parentchild.xml:73#, no-c-formatmsgid "If we were to execute the following code"msgstr "우리가 다음 코드를 실행시켰다면"#. Tag: programlisting#: example_parentchild.xml:77#, no-c-formatmsgid """<![CDATA[Parent p = .....;\n""Child c = new Child();\n""p.getChildren().add(c);\n""session.save(c);\n""session.flush();]]>"msgstr ""#. Tag: para#: example_parentchild.xml:79#, no-c-formatmsgid "Hibernate would issue two SQL statements:"msgstr "Hibernate는 두 개의 SQL 문장들을 실행할 것이다:"#. Tag: para#: example_parentchild.xml:85#, no-c-formatmsgid """an <literal>INSERT</literal> to create the record for <literal>c</literal>"msgstr """<literal>c</literal>에 대한 레코드를 생성시키는 <literal>INSERT</literal>"#. Tag: para#: example_parentchild.xml:88#, no-c-formatmsgid """an <literal>UPDATE</literal> to create the link from <literal>p</literal> to ""<literal>c</literal>"msgstr """<literal>p</literal>로부터 <literal>c</literal>로의 링크를 생성시키는 ""<literal>UPDATE</literal>"#. Tag: para#: example_parentchild.xml:95#, no-c-formatmsgid """This is not only inefficient, but also violates any <literal>NOT NULL</""literal> constraint on the <literal>parent_id</literal> column. We can fix ""the nullability constraint violation by specifying <literal>not-null=\"true""\"</literal> in the collection mapping:"msgstr """이것은 비효율적일 뿐만 아니라, 또한 <literal>parent_id</literal> 컬럼 상의 임""의의 <literal>NOT NULL</literal> 컨스트레인트에 위배된다. 우리는 콜렉션 매핑""에서 <literal>not-null=\"true\"</literal>를 지정함으로써 null 허용 가능 컨스""트레인트 위반을 정정할 수 있다:"#. Tag: programlisting#: example_parentchild.xml:101#, no-c-formatmsgid """<![CDATA[<set name=\"children\">\n"" <key column=\"parent_id\" not-null=\"true\"/>\n"" <one-to-many class=\"Child\"/>\n""</set>]]>"msgstr ""#. Tag: para#: example_parentchild.xml:103#, no-c-formatmsgid "However, this is not the recommended solution."msgstr "하지만 이것은 권장되는 해결책이 아니다."#. Tag: para#: example_parentchild.xml:106#, no-c-formatmsgid """The underlying cause of this behaviour is that the link (the foreign key ""<literal>parent_id</literal>) from <literal>p</literal> to <literal>c</""literal> is not considered part of the state of the <literal>Child</literal> ""object and is therefore not created in the <literal>INSERT</literal>. So the ""solution is to make the link part of the <literal>Child</literal> mapping."msgstr """이 행위의 기본 원인은 <literal>p</literal>로부터 <literal>c</literal>로의 링""크(foreign key <literal>parent_id</literal>)가 <literal>Child</literal> 객체""의 상태의 부분으로 간주되지 않고 그러므로 <literal>INSERT</literal>로 생성되""지 않는다는 점이다. 따라서 해결책은 <literal>Child</literal> 매핑의 링크 부분""을 만드는 것이다."#. Tag: programlisting#: example_parentchild.xml:113#, no-c-formatmsgid """<![CDATA[<many-to-one name=\"parent\" column=\"parent_id\" not-null=\"true\"/"">]]>"msgstr ""#. Tag: para#: example_parentchild.xml:115#, no-c-formatmsgid """(We also need to add the <literal>parent</literal> property to the ""<literal>Child</literal> class.)"msgstr """(우리는 또한 <literal>parent</literal> 프로퍼티를 <literal>Child</literal> 클""래스에 추가시킬 필요가 있다.)"#. Tag: para#: example_parentchild.xml:119#, no-c-formatmsgid """Now that the <literal>Child</literal> entity is managing the state of the ""link, we tell the collection not to update the link. We use the ""<literal>inverse</literal> attribute."msgstr """이제 <literal>Child</literal> 엔티티가 링크의 상태를 관리한다는 점을 노트하""고, 우리는 링크를 업데이트 시키지 말도록 콜렉션에게 통보한다. 우리는 ""<literal>inverse</literal> 속성을 사용한다."#. Tag: programlisting#: example_parentchild.xml:124#, no-c-formatmsgid """<![CDATA[<set name=\"children\" inverse=\"true\">\n"" <key column=\"parent_id\"/>\n"" <one-to-many class=\"Child\"/>\n""</set>]]>"msgstr ""#. Tag: para#: example_parentchild.xml:126#, no-c-formatmsgid "The following code would be used to add a new <literal>Child</literal>"msgstr """다음 코드는 새로운 <literal>Child</literal>를 추가시키는데 사용될 것이다"#. Tag: programlisting#: example_parentchild.xml:130#, no-c-formatmsgid """<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n""Child c = new Child();\n""c.setParent(p);\n""p.getChildren().add(c);\n""session.save(c);\n""session.flush();]]>"msgstr ""#. Tag: para#: example_parentchild.xml:132#, no-c-format
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -