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

📄 persistent_classes.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 3 页
字号:
"들을 영속화 시킬 수 있지만 당신은 lazy 연관 페칭(lazy association fetching)""에 대해 프락시들을 사용할 수 없을 것이다 -그것은 퍼포먼스 튜닝을 위한 당신의 ""옵션들을 제한시킬 것이다."#. Tag: para#: persistent_classes.xml:107#, no-c-formatmsgid """You should also avoid declaring <literal>public final</literal> methods on ""the non-final classes. If you want to use a class with a <literal>public ""final</literal> method, you must explicitly disable proxying by setting ""<literal>lazy=\"false\"</literal>."msgstr """당신은 또한 non-final 클래스들 상에 <literal>public final</literal> 메소드들""을 선언하는 것을 피해야 한다. 만일 당신이 <literal>public final</literal> 메""소드를 가진 클래스를 사용하고자 원할 경우, 당신은 <literal>lazy=\"false\"</""literal>를 설정함으로써 명시적으로 프락싱을 사용 불가능하도록 해야 한다."#. Tag: title#: persistent_classes.xml:115#, no-c-formatmsgid "Declare accessors and mutators for persistent fields (optional)"msgstr "영속 필드들을 위한 accessor들과 mutator들을 선언하라(옵션)"#. Tag: para#: persistent_classes.xml:117#, no-c-formatmsgid """<literal>Cat</literal> declares accessor methods for all its persistent ""fields. Many other ORM tools directly persist instance variables. We believe ""it is better to provide an indirection between the relational schema and ""internal data structures of the class. By default, Hibernate persists ""JavaBeans style properties, and recognizes method names of the form ""<literal>getFoo</literal>, <literal>isFoo</literal> and <literal>setFoo</""literal>. You may switch to direct field access for particular properties, ""if needed."msgstr """<literal>Cat</literal>은 그것의 모든 영속 필드들에 대해 accessor 메소드들을 ""선언한다. 많은 다른 ORM 도구들은 인스턴스 변수들을 직접 영속화 시킨다. 우리""는 관계형 스키마와 클래스의 내부적인 데이터 구조들 사이에 간접적인 수단을 제""공하는 것이 더 좋다고 믿고 있다. 디폴트로 Hibernate는 자바빈즈 스타일 프로퍼""티들을 영속화 시키고, <literal>getFoo</literal>, <literal>isFoo</literal>와 ""<literal>setFoo</literal> 형식의 메소드 이름들을 인지한다. 당신은 진정으로 특""정 프로퍼티에 대한 직접적인 필드 접근으로 전환할 수도 있다."#. Tag: para#: persistent_classes.xml:127#, no-c-formatmsgid """Properties need <emphasis>not</emphasis> be declared public - Hibernate can ""persist a property with a default, <literal>protected</literal> or ""<literal>private</literal> get / set pair."msgstr """프로퍼티들은 public으로 선언될 필요가 <emphasis>없다</emphasis> - Hibernate""는 디폴트로 <literal>protected</literal> get/set 쌍 또는 <literal>private</""literal> get/set 쌍을 가진 프로퍼티를 영속화 시킬 수 있다."#. Tag: title#: persistent_classes.xml:138#, no-c-formatmsgid "Implementing inheritance"msgstr "상속 구현하기"#. Tag: para#: persistent_classes.xml:140#, no-c-formatmsgid """A subclass must also observe the first and second rules. It inherits its ""identifier property from the superclass, <literal>Cat</literal>."msgstr """서브클래스는 또한 첫 번째 규칙들과 두 번째 규칙들을 주시해야 한다. 그것은 슈""퍼클래스 <literal>Cat</literal>으로부터 그것의 identifier 프로퍼티를 상속받는""다."#. Tag: programlisting#: persistent_classes.xml:145#, no-c-formatmsgid """<![CDATA[package eg;\n""\n""public class DomesticCat extends Cat {\n""        private String name;\n""\n""        public String getName() {\n""                return name;\n""        }\n""        protected void setName(String name) {\n""                this.name=name;\n""        }\n""}]]>"msgstr ""#. Tag: title#: persistent_classes.xml:149#, no-c-formatmsgid """Implementing <literal>equals()</literal> and <literal>hashCode()</literal>"msgstr "<literal>equals()</literal>와 <literal>hashCode()</literal> 구현하기"#. Tag: para#: persistent_classes.xml:151#, no-c-formatmsgid """You have to override the <literal>equals()</literal> and <literal>hashCode()""</literal> methods if you"msgstr """만일 당신이 다음의 경우라면, 당신은 <literal>equals()</literal>와 ""<literal>hashCode()</literal> 메소드들을 오버라이드 시켜야 한다."#. Tag: para#: persistent_classes.xml:157#, no-c-formatmsgid """intend to put instances of persistent classes in a <literal>Set</literal> ""(the recommended way to represent many-valued associations) <emphasis>and</""emphasis>"msgstr """하나의 <literal>Set</literal> 속에 영속 클래스들의 인스턴스들을 집어넣고자 의""도하고 (many-valued 연관들에 대해 권장되는 방법) <emphasis>그리고</emphasis>"#. Tag: para#: persistent_classes.xml:164#, no-c-formatmsgid "intend to use reattachment of detached instances"msgstr "detached 인스턴스들의 reattachment(재첨부)를 사용하고자 의도하는"#. Tag: para#: persistent_classes.xml:170#, no-c-formatmsgid """Hibernate guarantees equivalence of persistent identity (database row) and ""Java identity only inside a particular session scope. So as soon as we mix ""instances retrieved in different sessions, we must implement <literal>equals""()</literal> and <literal>hashCode()</literal> if we wish to have meaningful ""semantics for <literal>Set</literal>s."msgstr """Hibernate는 특정 session 범위 내에서만 persistent identity(데이터베이스 행)""과 Java identity의 같음을 보장한다. 따라서 우리가 다른 세션들에서 검색된 인스""턴스들을 혼합시키자마자, 우리가 <literal>Set</literal>들에 대해 유의미하게 만""들고자 원할 경우, 우리는 <literal>equals()</literal>와 <literal>hashCode()</""literal>를 구현해야 한다."#. Tag: para#: persistent_classes.xml:178#, no-c-formatmsgid """The most obvious way is to implement <literal>equals()</literal>/""<literal>hashCode()</literal> by comparing the identifier value of both ""objects. If the value is the same, both must be the same database row, they ""are therefore equal (if both are added to a <literal>Set</literal>, we will ""only have one element in the <literal>Set</literal>). Unfortunately, we ""can't use that approach with generated identifiers! Hibernate will only ""assign identifier values to objects that are persistent, a newly created ""instance will not have any identifier value! Furthermore, if an instance is ""unsaved and currently in a <literal>Set</literal>, saving it will assign an ""identifier value to the object. If <literal>equals()</literal> and ""<literal>hashCode()</literal> are based on the identifier value, the hash ""code would change, breaking the contract of the <literal>Set</literal>. See ""the Hibernate website for a full discussion of this problem. Note that this ""is not a Hibernate issue, but normal Java semantics of object identity and ""equality."msgstr """가장 명백한 방법은 두 객체들의 identifier 값을 비교함으로써 <literal>equals()""</literal>/<literal>hashCode()</literal>를 구현하는 것이다. 만일 그 값이 동일""하다면, 둘다 동일한 데이터베이스 행이어야 하고, 그러므로 그것들은 같다(둘다 ""하나의 <literal>Set</literal>에 추가되는 경우에, 우리는 <literal>Set</""literal> 속에서 하나의 요소만을 갖게 될 것이다). 불행하게도, 우리는 생성되는 ""식별자들을 갖는 그 접근법을 사용할 수 없다! Hibernate는 오직 식별자 값들을 영""속화 되는 객체들에 할당할 것이고, 새로이 생성된 인스턴스는 임의의 identifier ""값을 갖지 않을 것이다! 만일 인스턴스가 저장되지 않고 현재 하나의 ""<literal>Set</literal> 속에 있을 경우에, 그것을 저장하는것은 하나의 식별자 값""을 그 객체에게 할당할 것이다. 만일 <literal>equals()</literal>와 ""<literal>hashCode()</literal>가 그 식별자 값에 기초할 경우, hash 코드는 ""<literal>Set</literal>의 계약을 파기하여 변경될 것이다. 이 문제에 대한 전체 ""논의에 대해서는 Hibernate 웹 사이트를 보라. 이것은 Hibernate 쟁점이 아닌, 객""체 identity와 equality에 관한 통상의 자바 의미론임을 노트하라."#. Tag: para#: persistent_classes.xml:192#, no-c-formatmsgid """We recommend implementing <literal>equals()</literal> and <literal>hashCode()""</literal> using <emphasis>Business key equality</emphasis>. Business key ""equality means that the <literal>equals()</literal> method compares only the ""properties that form the business key, a key that would identify our ""instance in the real world (a <emphasis>natural</emphasis> candidate key):"msgstr """우리는 <emphasis>Business key equality</emphasis>를 사용하여 <literal>equals""()</literal>와 <literal>hashCode()</literal>를 구현할 것 권장한다. Business ""key equality는 <literal>equals()</literal> 메소드가 비지니스 키, 즉 실세계에""서 우리의 인스턴스를 식별하게 될 키(<emphasis>natural</emphasis> 후보 키)를 ""형성하는 프로퍼티들만을 비교한다는 점을 의미한다 :"#. Tag: programlisting#: persistent_classes.xml:200#, no-c-formatmsgid """<![CDATA[public class Cat {\n""\n""    ...\n""    public boolean equals(Object other) {\n""        if (this == other) return true;\n""        if ( !(other instanceof Cat) ) return false;\n""\n""        final Cat cat = (Cat) other;\n""\n""        if ( !cat.getLitterId().equals( getLitterId() ) ) return false;\n""        if ( !cat.getMother().equals( getMother() ) ) return false;\n""\n""        return true;\n""    }\n""\n""    public int hashCode() {\n""        int result;\n""        result = getMother().hashCode();\n""        result = 29 * result + getLitterId();\n""        return result;\n""    }\n""\n""}]]>"msgstr ""#. Tag: para#: persistent_classes.xml:202#, no-c-formatmsgid """Note that a business key does not have to be as solid as a database primary ""key candidate (see <xref linkend=\"transactions-basics-identity\"/>). ""Immutable or unique properties are usually good candidates for a business ""key."msgstr """하나의 비지니스 키는 데이터베이스 프라이머리 키 후보 만큼 견고하지 않아야 한""다(<xref linkend=\"transactions-basics-identity\"/>를 보라). 대개 변경할 수 ""없는 프로퍼티 또는 유일한(unique) 프로퍼티는 대개 비지니스 키에 대한 좋은 후""보들이다."#. Tag: title#: persistent_classes.xml:212#, no-c-formatmsgid "Dynamic models"msgstr "동적인 모형들"#. Tag: emphasis#: persistent_classes.xml:215#, no-c-formatmsgid """Note that the following features are currently considered experimental and ""may change in the near future."msgstr """다음 특징들은 현재 실험적으로 고려되고 있으며 장래에는 변경될 수 있음을 노트""하라."#. Tag: para#: persistent_classes.xml:219#, no-c-formatmsgid """Persistent entities don't necessarily have to be represented as POJO classes ""or as JavaBean objects at runtime. Hibernate also supports dynamic models ""(using <literal>Map</literal>s of <literal>Map</literal>s at runtime) and ""the representation of entities as DOM4J trees. With this approach, you don't ""write persistent classes, only mapping files."msgstr """영속 엔티티들은 반드시 실행시에 POJO 클래스들로 또는 자바빈즈 객체들로 표현되""어야할 필요는 없다. Hibernate는 또한 (실행 시에 <literal>Map</literal>들을 가""진 <literal>Map</literal>들을 사용하여) 동적인 모형들을 지원하고 DOM4J 트리들""로서 엔티티들에 대한 표현을 지원한다. 이 접근법으로, 당신은 영속 클래스들을 ""작성하지 않고, 오직 매핑 파일들 만을 작성한다."#. Tag: para#: persistent_classes.xml:227#, no-c-formatmsgid """By default, Hibernate works in normal POJO mode. You may set a default ""entity representation mode for a particular <literal>SessionFactory</""literal> using the <literal>default_entity_mode</literal> configuration ""option (see <xref linkend=\"configuration-optional-properties\"/>."msgstr """디폴트로, Hibernate는 통산의 POJO 모드로 동작한다. 당신은 ""<literal>default_entity_mode</literal> 구성 옵션을 사용하여 특별한 ""<literal>SessionFactory</literal>에 대해 디폴트 엔티티 표현 모드를 설정할 수 ""있다 (<xref linkend=\"configuration-optional-properties\"/>을 보라)."#. Tag: para#: persistent_classes.xml:234#, no-c-formatmsgid ""

⌨️ 快捷键说明

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