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

📄 persistent_classes.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 3 页
字号:
"The following examples demonstrates the representation using <literal>Map</""literal>s. First, in the mapping file, an <literal>entity-name</literal> has ""to be declared instead of (or in addition to) a class name:"msgstr """다음 예제들은<literal>Map</literal>들을 사용하는 표현을 설명한다. 먼저 매핑 ""파일에서, <literal>entity-name</literal>은 클래스 이름 대신에(또는 클래스 이""름에 덧붙여) 선언되어야 한다:"#. Tag: programlisting#: persistent_classes.xml:240#, no-c-formatmsgid """<![CDATA[<hibernate-mapping>\n""\n""    <class entity-name=\"Customer\">\n""\n""        <id name=\"id\"\n""            type=\"long\"\n""            column=\"ID\">\n""            <generator class=\"sequence\"/>\n""        </id>\n""\n""        <property name=\"name\"\n""            column=\"NAME\"\n""            type=\"string\"/>\n""\n""        <property name=\"address\"\n""            column=\"ADDRESS\"\n""            type=\"string\"/>\n""\n""        <many-to-one name=\"organization\"\n""            column=\"ORGANIZATION_ID\"\n""            class=\"Organization\"/>\n""\n""        <bag name=\"orders\"\n""            inverse=\"true\"\n""            lazy=\"false\"\n""            cascade=\"all\">\n""            <key column=\"CUSTOMER_ID\"/>\n""            <one-to-many class=\"Order\"/>\n""        </bag>\n""\n""    </class>\n""    \n""</hibernate-mapping>]]>"msgstr ""#. Tag: para#: persistent_classes.xml:242#, no-c-formatmsgid """Note that even though associations are declared using target class names, ""the target type of an associations may also be a dynamic entity instead of a ""POJO."msgstr """심지어 비록 연관들이 대상(target) 클래스 이름들을 사용하여 선언될지라도, 연관""들의 대상(target) 타입은 또한 POJO가 아닌 동적인 엔티티일 수 있음을 노트하라."#. Tag: para#: persistent_classes.xml:249#, no-c-formatmsgid """After setting the default entity mode to <literal>dynamic-map</literal> for ""the <literal>SessionFactory</literal>, we can at runtime work with ""<literal>Map</literal>s of <literal>Map</literal>s:"msgstr """<literal>SessionFactory</literal>에 대한 디폴트 엔티티 모드를 ""<literal>dynamic-map</literal>으로 설정한 후에, 우리는 <literal>Map</literal>""들을 가진 <literal>Map</literal>들에 대해 실행 시에 작업할 수 있다:"#. Tag: programlisting#: persistent_classes.xml:255#, no-c-formatmsgid """<![CDATA[Session s = openSession();\n""Transaction tx = s.beginTransaction();\n""Session s = openSession();\n""\n""// Create a customer\n""Map david = new HashMap();\n""david.put(\"name\", \"David\");\n""\n""// Create an organization\n""Map foobar = new HashMap();\n""foobar.put(\"name\", \"Foobar Inc.\");\n""\n""// Link both\n""david.put(\"organization\", foobar);\n""\n""// Save both\n""s.save(\"Customer\", david);\n""s.save(\"Organization\", foobar);\n""\n""tx.commit();\n""s.close();]]>"msgstr ""#. Tag: para#: persistent_classes.xml:257#, no-c-formatmsgid """The advantages of a dynamic mapping are quick turnaround time for ""prototyping without the need for entity class implementation. However, you ""lose compile-time type checking and will very likely deal with many ""exceptions at runtime. Thanks to the Hibernate mapping, the database schema ""can easily be normalized and sound, allowing to add a proper domain model ""implementation on top later on."msgstr """dynamic 매핑의 장점들은 엔티티 클래스 구현에 대한 필요 없이도 프로토타이핑을 ""위한 빠른 전환 시간이다. 하지만 당신은 컴파일 시 타입 체킹을 잃고 실행 시에 ""많은 예외상황들을 다루게 될 것이다. Hibernate 매핑 덕분에, 나중에 고유한 도메""인 모형 구현을 상단에 추가하는 것이 허용되어서, 데이터베이스 스키마가 쉽게 정""규화 되고 소리가 울려 퍼질 수 있다."#. Tag: para#: persistent_classes.xml:265#, no-c-formatmsgid """Entity representation modes can also be set on a per <literal>Session</""literal> basis:"msgstr """엔티티 표현 모드들은 또한 하나의 단위 <literal>Session</literal> 기준에 대해 ""설정될 수 있다:"#. Tag: programlisting#: persistent_classes.xml:270#, no-c-formatmsgid """<![CDATA[Session dynamicSession = pojoSession.getSession(EntityMode.MAP);\n""\n""// Create a customer\n""Map david = new HashMap();\n""david.put(\"name\", \"David\");\n""dynamicSession.save(\"Customer\", david);\n""...\n""dynamicSession.flush();\n""dynamicSession.close()\n""...\n""// Continue on pojoSession\n""]]>"msgstr ""#. Tag: para#: persistent_classes.xml:273#, no-c-formatmsgid """Please note that the call to <literal>getSession()</literal> using an ""<literal>EntityMode</literal> is on the <literal>Session</literal> API, not ""the <literal>SessionFactory</literal>. That way, the new <literal>Session</""literal> shares the underlying JDBC connection, transaction, and other ""context information. This means you don't have tocall <literal>flush()</""literal> and <literal>close()</literal> on the secondary <literal>Session</""literal>, and also leave the transaction and connection handling to the ""primary unit of work."msgstr """<literal>EntityMode</literal>를 사용하는 <literal>getSession()</literal>에 대""한 호출은 <literal>SessionFactory</literal>가 아닌, <literal>Session</""literal> API에 대한 것임을 노트하길 바란다. 그 방법으로, 새로운 ""<literal>Session</literal>은 기본 JDBC 커넥션, 트랜잭션, 그리고 다른 컨텍스""트 정보를 공유한다. 이것은 당신이 두 번째 <literal>Session</literal> 상에서 ""<literal>flush()</literal>와 <literal>close()</literal>를 호출하지 말아야 하""고, 또한 트랜잭션 및 커넥션 핸들링을 주된 작업 단위에게 맡긴다는 점을 의미한""다."#. Tag: para#: persistent_classes.xml:283#, no-c-formatmsgid """More information about the XML representation capabilities can be found in ""<xref linkend=\"xml\"/>."msgstr """XML 표현 가용성들에 대한 추가 정보는 <xref linkend=\"xml\"/>에서 찾을 수 있""다."#. Tag: title#: persistent_classes.xml:291#, no-c-formatmsgid "Tuplizers"msgstr "Tuplizer들"#. Tag: para#: persistent_classes.xml:293#, no-c-formatmsgid """<literal>org.hibernate.tuple.Tuplizer</literal>, and its sub-interfaces, are ""responsible for managing a particular representation of a piece of data, ""given that representation's <literal>org.hibernate.EntityMode</literal>. If ""a given piece of data is thought of as a data structure, then a tuplizer is ""the thing which knows how to create such a data structure and how to extract ""values from and inject values into such a data structure. For example, for ""the POJO entity mode, the correpsonding tuplizer knows how create the POJO ""through its constructor and how to access the POJO properties using the ""defined property accessors. There are two high-level types of Tuplizers, ""represented by the <literal>org.hibernate.tuple.entity.EntityTuplizer</""literal> and <literal>org.hibernate.tuple.component.ComponentTuplizer</""literal> interfaces. <literal>EntityTuplizer</literal>s are responsible for ""managing the above mentioned contracts in regards to entities, while ""<literal>ComponentTuplizer</literal>s do the same for components."msgstr """<literal>org.hibernate.tuple.Tuplizer</literal>, 그리고 그것의 서브-인터페이""스들은 데이터의 조각에 대한 특별한 표현의 <literal>org.hibernate.EntityMode</""literal>가 주어지면 그 표현을 관리하는 책임이 있다. 만일 주어진 데이터 조각""이 하나의 데이터 구조로 간주될 경우, 그때 하나의 tuplizer는 그런 데이터 구조""를 생성시키는 방법과 그런 데이터 구조로부터 값들을 추출시키는 방법 그리고 그""런 데이터구조 속으로 값들을 삽입시키는 방법을 알고 있는 것이다. 예를 들어, ""POJO 엔티티 모드의 경우, 대응하는 tuplizer는 그것의 생성자를 통해 POJO를 생성""시키는 방법, 그리고 정의된 프로퍼티 접근자들을 사용하여 POJO 프로퍼티들에 접""근하는 방법을 안다. <literal>org.hibernate.tuple.entity.EntityTuplizer</""literal> 인터페이스와 <literal>org.hibernate.tuple.component.""ComponentTuplizer</literal> 인터페이스에 의해 표현되는 두 가지 고급 유형의 ""Tuplizer들이 존재한다. <literal>EntityTuplizer</literal>들은 엔티티들에 관해""서는 위에 언급된 계약들을 매핑할 책임이 있는 반면에, ""<literal>ComponentTuplizer</literal>들은 컴포넌트들에 대해서도 동일한 것을 행""한다."#. Tag: para#: persistent_classes.xml:308#, no-c-formatmsgid """Users may also plug in their own tuplizers. Perhaps you require that a ""<literal>java.util.Map</literal> implementation other than <literal>java.""util.HashMap</literal> be used while in the dynamic-map entity-mode; or ""perhaps you need to define a different proxy generation strategy than the ""one used by default. Both would be achieved by defining a custom tuplizer ""implementation. Tuplizers definitions are attached to the entity or ""component mapping they are meant to manage. Going back to the example of our ""customer entity:"msgstr """사용자들은 또한 그들 자신의 tuplizer들을 플러그 시킬 수 있다. 아마 당신은 ""dynamic-map entity-mode 동안에 사용되는 <literal>java.util.HashMap</literal> ""대신에 하나의 <literal>java.util.Map</literal> 구현을 필요로 한다; 또는 아마 ""당신은 디폴트로 사용되는 방도 보다는 하나의 다른 다른 프릭시 산출 방도를 필요""로 한다. 둘다 하나의 맞춤형 tuplizer를 정의함으로써 성취될 것이다. Tuplizer""들 정의들은 그것들이 관리할 수단인 엔티티 매핑 또는 컴포넌트 매핑에 첨부된""다. 우리의 고객 엔티티에 대한 예제로 되돌아가면:"#. Tag: programlisting#: persistent_classes.xml:317#, no-c-formatmsgid """<![CDATA[<hibernate-mapping>\n""    <class entity-name=\"Customer\">\n""        <!--\n""            Override the dynamic-map entity-mode\n""            tuplizer for the customer entity\n""        -->\n""        <tuplizer entity-mode=\"dynamic-map\"\n""                class=\"CustomMapTuplizerImpl\"/>\n""\n""        <id name=\"id\" type=\"long\" column=\"ID\">\n""            <generator class=\"sequence\"/>\n""        </id>\n""\n""        <!-- other properties -->\n""        ...\n""    </class>\n""</hibernate-mapping>\n""\n""\n""public class CustomMapTuplizerImpl\n""        extends org.hibernate.tuple.entity.DynamicMapEntityTuplizer {\n""    // override the buildInstantiator() method to plug in our custom map...\n""    protected final Instantiator buildInstantiator(\n""            org.hibernate.mapping.PersistentClass mappingInfo) {\n""        return new CustomMapInstantiator( mappingInfo );\n""    }\n""\n""    private static final class CustomMapInstantiator\n""            extends org.hibernate.tuple.DynamicMapInstantitor {\n""        // override the generateMap() method to return our custom map...\n""            protected final Map generateMap() {\n""                    return new CustomMap();\n""            }\n""    }\n""}]]>"msgstr ""#. Tag: para#: persistent_classes.xml:322#, no-c-formatmsgid """TODO: Document user-extension framework in the property and proxy packages"msgstr """TODO: property 패키지와 proxy 패키지 내에 user-extension 프레임웍을 문서화 ""할 것."

⌨️ 快捷键说明

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