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

📄 persistent_classes.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 3 页
字号:
"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 """Debes tambi&#x00e9;n evitar declarar m&#x00e9;todos <literal>public final</""literal> en clases non-final. Si quieres usar una clase con un m&#x00e9;todo ""<literal>public final</literal>, debes deshabilitar expl&#x00ed;citamente el ""uso de proxies estableciendo <literal>lazy=\"false\"</literal>."#: index.docbook:115msgid "Declare accessors and mutators for persistent fields (optional)"msgstr """Declara m&#x00e9;todos de acceso y modificaci&#x00f3;n para los campos ""persistentes (opcional)"#: index.docbook:117msgid """<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> declara m&#x00e9;todos de acceso para todos sus ""campos persistente. Muchas otras herramientas ORM persisten directamente ""variables de instancia. Creemos que es mejor proveer una indirecci&#x00f3;n ""entre el esquema relacional y las estructuras internas de la clase. Por ""defecto, Hibernate persiste propiedades del estilo JavaBeans, y reconoce ""nombres de m&#x00e9;todo de la forma <literal>getFoo</literal>, ""<literal>isFoo</literal> y <literal>setFoo</literal>. Puedes cambiar a ""acceso directo a campos para propiedades en particular, de ser necesario."#: index.docbook:127msgid """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 """Las propiedades <emphasis>no</emphasis> necesitan ser declaradas p&#x00fa;""blicas. Hibernate puede persistir una propiedad con un par get / set ""<literal>protected</literal> o <literal>private</literal>."#: index.docbook:138msgid "Implementing inheritance"msgstr "Implementando herencia"#: index.docbook:140msgid """A subclass must also observe the first and second rules. It inherits its ""identifier property from the superclass, <literal>Cat</literal>."msgstr """Una subclase puede a su vez observar la primera y segunda regla. Hereda su ""propiedad identificadora de la superclase, <literal>Cat</literal>."#: index.docbook:145msgid """<![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 """<![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""}]]>"#: index.docbook:149msgid """Implementing <literal>equals()</literal> and <literal>hashCode()</literal>"msgstr """Implementando <literal>equals()</literal> y <literal>hashCode()</literal>"#: index.docbook:151msgid """You have to override the <literal>equals()</literal> and <literal>hashCode()""</literal> methods if you"msgstr """Tienes que sobrescribir los m&#x00e9;todos <literal>equals()</literal> y ""<literal>hashCode()</literal> si :"#: index.docbook:157msgid """intend to put instances of persistent classes in a <literal>Set</literal> ""(the recommended way to represent many-valued associations) <emphasis>and</""emphasis>"msgstr """piensas poner instancias de clases persistentes en un <literal>Set</literal> ""(la forma recomendada de representar asociaciones multivaluadas) ""<emphasis>y</emphasis>"#: index.docbook:164msgid "intend to use reattachment of detached instances"msgstr "piensas usar reasociaci&#x00f3;n de instancias separadas."#: index.docbook:170msgid """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 garantiza la equivalencia de identidad persistente (fila de base ""de datos) y identidad Java s&#x00f3;lo dentro del &#x00e1;mbito de una ""sesi&#x00f3;n en particular. De modo que en el momento que mezclamos ""instancias recuperadas en sesiones diferentes, debemos implementar ""<literal>equals()</literal> y <literal>hashCode()</literal> si deseamos ""tener una sem&#x00e1;ntica significativa de <literal>Set</literal>s."#: index.docbook:178msgid """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 """La forma m&#x00e1;s obvia es implementar <literal>equals()</literal>/""<literal>hashCode()</literal> comparando el valor identificador de ambos ""objetos. Si el valor es el mismo, ambos deben ser la misma fila de base de ""datos, por lo tanto son iguales (si ambos son agregados a un <literal>Set</""literal>, s&#x00f3;lo tendremos un elemento en el <literal>Set</literal>). ""Desafortunadamente, no podemos usar este enfoque con identificadores ""generados! Hibernate s&#x00f3;lo asignar&#x00e1; valores identificadores a ""objetos que son persistentes, una instancia reci&#x00e9;n creada no ""tendr&#x00e1; ning&#x00fa;n valor identificador! Adem&#x00e1;s, si una ""instancia no est&#x00e1; salvada y est&#x00e1; actualmente en un ""<literal>Set</literal>, salvarla asignar&#x00e1; un valor identificador al ""objeto. Si <literal>equals()</literal> and <literal>hashCode()</literal> ""est&#x00e1;n basados en el valor identificador, el c&#x00f3;digo hash ""podr&#x00ed;a cambiar, rompiendo el contrato de <literal>Set</literal>. Ver ""el sitio web de Hibernate para una discusi&#x00f3;n completa de este ""problema. Observa que esto no es una incidencia de Hibernate, sino la ""sem&#x00e1;ntica normal de Java de identidad de objeto e igualdad."#: index.docbook:192msgid """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 """Recomendamos implementar <literal>equals()</literal> y <literal>hashCode()</""literal> usando <emphasis>igualdad de clave de negocio (Business key ""equality)</emphasis>. Igualdad de clave de negocio significa que el m&#x00e9;""todo <literal>equals()</literal> compara s&#x00f3;lo las propiedades que ""forman la clave de negocio, una clave que podr&#x00ed;a identificar nuestra ""instancia en el mundo real (una clave candidata <emphasis>natural</""emphasis>):"#: index.docbook:200msgid """<![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 """<![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""}]]>"#: index.docbook:202msgid """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 """Nota que una clave de negocio no tiene que ser tan s&#x00f3;lida como una ""clave primaria candidata de base de datos (ver <xref linkend=\"transactions-""basics-identity\"/>). Las propiedades inmutables o &#x00fa;nicas son ""usualmente buenas candidatas para una clave de negocio."#: index.docbook:212msgid "Dynamic models"msgstr "Modelos din&#x00e1;micos"#: index.docbook:215msgid """Note that the following features are currently considered experimental and ""may change in the near future."msgstr """Ten en cuenta que las siguientes funcionalidades est&#x00e1;n consideradas ""actualmente experimentales y pueden cambiar en el futuro cercano."#: index.docbook:219msgid """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 """Las entidades persistentes no necesariamente tienen que estar representadas ""como clases POJO o como objetos JavaBean en tiempo de ejecuci&#x00f3;n. ""Hibernate soporta adem&#x00e1;s modelos din&#x00e1;micos (usando ""<literal>Map</literal>s de <literal>Map</literal>s en tiempo de ""ejecuci&#x00f3;n) y la representaci&#x00f3;n de entidades como &#x00e1;""rboles de DOM4J. Con este enfoque no escribes clases persistentes, s&#x00f3;""lo ficheros de mapeo."#: index.docbook:227msgid """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 """Por defecto, Hibernate funciona en modo POJO normal. Puedes establecer una ""representaci&#x00f3;n de entidad por defecto para una ""<literal>SessionFactory</literal> en particular usando la opci&#x00f3;n de ""configuraci&#x00f3;n <literal>default_entity_mode</literal> (ver <xref ""linkend=\"configuration-optional-properties\"/>)."#: index.docbook:234msgid """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 """Los siguientes ejemplos demuestran la representaci&#x00f3;n usando ""<literal>Map</literal>s. Primero, en el fichero de mapeo, tiene que ""declararse un <literal>entity-name</literal> en vez de (o como agregado a) ""un nombre de clase:"#: index.docbook:240msgid """<![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 """<![CDATA[<hibernate-mapping>\n""\n"

⌨️ 快捷键说明

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