📄 persistent_classes.po
字号:
"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én evitar declarar métodos <literal>public final</""literal> en clases non-final. Si quieres usar una clase con un método ""<literal>public final</literal>, debes deshabilitar explícitamente el ""uso de proxies estableciendo <literal>lazy=\"false\"</literal>."#: index.docbook:115msgid "Declare accessors and mutators for persistent fields (optional)"msgstr """Declara métodos de acceso y modificació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étodos de acceso para todos sus ""campos persistente. Muchas otras herramientas ORM persisten directamente ""variables de instancia. Creemos que es mejor proveer una indirecció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é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ú""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é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ó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ólo dentro del ámbito de una ""sesió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á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á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ólo tendremos un elemento en el <literal>Set</literal>). ""Desafortunadamente, no podemos usar este enfoque con identificadores ""generados! Hibernate sólo asignará valores identificadores a ""objetos que son persistentes, una instancia recién creada no ""tendrá ningún valor identificador! Además, si una ""instancia no está salvada y está actualmente en un ""<literal>Set</literal>, salvarla asignará un valor identificador al ""objeto. Si <literal>equals()</literal> and <literal>hashCode()</literal> ""están basados en el valor identificador, el código hash ""podría cambiar, rompiendo el contrato de <literal>Set</literal>. Ver ""el sitio web de Hibernate para una discusión completa de este ""problema. Observa que esto no es una incidencia de Hibernate, sino la ""semá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é""todo <literal>equals()</literal> compara sólo las propiedades que ""forman la clave de negocio, una clave que podrí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ólida como una ""clave primaria candidata de base de datos (ver <xref linkend=\"transactions-""basics-identity\"/>). Las propiedades inmutables o únicas son ""usualmente buenas candidatas para una clave de negocio."#: index.docbook:212msgid "Dynamic models"msgstr "Modelos diná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á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ón. ""Hibernate soporta además modelos dinámicos (usando ""<literal>Map</literal>s de <literal>Map</literal>s en tiempo de ""ejecución) y la representación de entidades como á""rboles de DOM4J. Con este enfoque no escribes clases persistentes, só""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ón de entidad por defecto para una ""<literal>SessionFactory</literal> en particular usando la opción de ""configuració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ó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 + -