📄 session_api.po
字号:
#, fuzzymsgid ""msgstr """PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Content-Type: text/plain; charset=utf-8\n"#: index.docbook:5msgid "Working with objects"msgstr "Trabajando con objetos"#: index.docbook:7msgid """Hibernate is a full object/relational mapping solution that not only shields ""the developer from the details of the underlying database management system, ""but also offers <emphasis>state management</emphasis> of objects. This is, ""contrary to the management of SQL <literal>statements</literal> in common ""JDBC/SQL persistence layers, a very natural object-oriented view of ""persistence in Java applications."msgstr """Hibernate es una solución completa de mapeo objeto/relacional que no ""sólo abstrae al desarrollador de los detalles del sistema de manejo ""de base datos subyacente, sino que además ofrece <emphasis>manejo de ""estado</emphasis> de objetos. Esto es, al contrario del manejo de ""<literal>sentencias</literal> SQL en capas comunes de persistencia JDBC/SQL, ""una vista de la persistencia en aplicaciones Java muy natural y orientada a ""objetos."#: index.docbook:16msgid """In other words, Hibernate application developers should always think about ""the <emphasis>state</emphasis> of their objects, and not necessarily about ""the execution of SQL statements. This part is taken care of by Hibernate and ""is only relevant for the application developer when tuning the performance ""of the system."msgstr """En otras palabras, los desarroladores de aplicaciones Hibernate deben ""siempre pensar en el <emphasis>estado</emphasis> de sus objetos, y no ""necesariamente en la ejecución de sentencias SQL. Esta parte es ""cuidada por Hibernate y es sólo relevante para el desarrollador de la ""aplicación al afinar el rendimiento del sistema."#: index.docbook:24msgid "Hibernate object states"msgstr "Estados de objeto de Hibernate"#: index.docbook:26msgid "Hibernate defines and supports the following object states:"msgstr "Hibernate define y soporta los siguientes estados de objeto:"#: index.docbook:32msgid """<emphasis>Transient</emphasis> - an object is transient if it has just been ""instantiated using the <literal>new</literal> operator, and it is not ""associated with a Hibernate <literal>Session</literal>. It has no persistent ""representation in the database and no identifier value has been assigned. ""Transient instances will be destroyed by the garbage collector if the ""application doesn't hold a reference anymore. Use the Hibernate ""<literal>Session</literal> to make an object persistent (and let Hibernate ""take care of the SQL statements that need to be executed for this ""transition)."msgstr """<emphasis>Transitorio</emphasis> - un objeto es transitorio si ha sido ""recién instanciado usando el operador <literal>new</literal>, y no ""está asociado a una <literal>Session</literal> de Hibernate. No tiene ""una representación persistente en la base de datos y no se le ha ""asignado un valor identificador. Las instancias transitorias serán ""destruídas por el recolector de basura si la aplicación no ""mantiene más una referencia. Usa la <literal>Session</literal> de ""Hibernate para hacer un objeto persistente (y deja que Hibernate cuide de ""las sentencias SQL que necesitan ejecutarse para esta transición)."#: index.docbook:44msgid """<emphasis>Persistent</emphasis> - a persistent instance has a representation ""in the database and an identifier value. It might just have been saved or ""loaded, however, it is by definition in the scope of a <literal>Session</""literal>. Hibernate will detect any changes made to an object in persistent ""state and synchronize the state with the database when the unit of work ""completes. Developers don't execute manual <literal>UPDATE</literal> ""statements, or <literal>DELETE</literal> statements when an object should be ""made transient."msgstr """<emphasis>Persistente</emphasis> - una instancia persistente tiene una ""representación en la base de datos y un valor identificador. Puede ""haber sido salvado o cargado, sin embargo, está por definición ""en el ámbito de una <literal>Session</literal>. Hibernate ""detectará cualquier cambio hecho a un objeto en estado persistentey ""sincronizará el estado con la base de datos cuando se complete la ""unidad de trabajo. Los desarrolladores no ejecutan sentencias ""<literal>UPDATE</literal> manuales, o sentencias <literal>DELETE</literal> ""cuando un objeto debe ser hecho transitorio."#: index.docbook:55msgid """<emphasis>Detached</emphasis> - a detached instance is an object that has ""been persistent, but its <literal>Session</literal> has been closed. The ""reference to the object is still valid, of course, and the detached instance ""might even be modified in this state. A detached instance can be reattached ""to a new <literal>Session</literal> at a later point in time, making it (and ""all the modifications) persistent again. This feature enables a programming ""model for long running units of work that require user think-time. We call ""them <emphasis>application transactions</emphasis>, i.e. a unit of work from ""the point of view of the user."msgstr """<emphasis>Separado (detached)</emphasis> - una instancia separada es un ""objeto que ha sido hecho persistente, pero su <literal>Session</literal> ha ""sido cerrada. La referencia al objeto todavía es válida, por ""supuesto, y la instancia separada podría incluso ser modificada en ""este estado. Una instancia separada puede ser re-unida a una nueva ""<literal>Session</literal> en un punto posterior en el tiempo, hacié""ndola persistente de nuevo (con todas las modificaciones). Este aspecto ""habilita un modelo de programación para unidades de trabajo de ""ejecución larga que requieren tiempo-para-pensar del usuario. Las ""llamamos <emphasis>transaccciones de aplicación</emphasis>, es decir, ""una unidad de trabajo desde el punto de vista del usuario."#: index.docbook:69msgid """We'll now discuss the states and state transitions (and the Hibernate ""methods that trigger a transition) in more detail."msgstr """Discutiremos ahora los estados y transiciones de estados (y los mé""todos de Hibernate que disparan una transición) en más detalle:"#: index.docbook:77msgid "Making objects persistent"msgstr "Haciendo los objetos persistentes"#: index.docbook:79msgid """Newly instantiated instances of a a persistent class are considered ""<emphasis>transient</emphasis> by Hibernate. We can make a transient ""instance <emphasis>persistent</emphasis> by associating it with a session:"msgstr """Las instancias recién instanciadas de una clase persistente son ""consideradas <emphasis>transitorias</emphasis> por Hibernate. Podemos hacer ""una instancia transitoria <emphasis>persistente</emphasis> asociá""ndola con una sesión:"#: index.docbook:86msgid """<![CDATA[DomesticCat fritz = new DomesticCat();\n""fritz.setColor(Color.GINGER);\n""fritz.setSex('M');\n""fritz.setName(\"Fritz\");\n""Long generatedId = (Long) sess.save(fritz);]]>"msgstr """<![CDATA[DomesticCat fritz = new DomesticCat();\n""fritz.setColor(Color.GINGER);\n""fritz.setSex('M');\n""fritz.setName(\"Fritz\");\n""Long generatedId = (Long) sess.save(fritz);]]>"#: index.docbook:88msgid """If <literal>Cat</literal> has a generated identifier, the identifier is ""generated and assigned to the <literal>cat</literal> when <literal>save()</""literal> is called. If <literal>Cat</literal> has an <literal>assigned</""literal> identifier, or a composite key, the identifier should be assigned ""to the <literal>cat</literal> instance before calling <literal>save()</""literal>. You may also use <literal>persist()</literal> instead of ""<literal>save()</literal>, with the semantics defined in the EJB3 early ""draft."msgstr """Si <literal>Cat</literal> tiene un identificador generado, el identificador ""es generado y asignado al <literal>cat</literal> cuando se llama a ""<literal>save()</literal>. Si <literal>Cat</literal> tiene un identificador ""<literal>assigned</literal>, o una clave compuesta, el identificador debe ""ser asignado a la instancia de <literal>cat</literal> antes de llamar a ""<literal>save()</literal>. Puedes también usar <literal>persist()</""literal> en vez de <literal>save()</literal>, con la semántica ""definida en el temprano borrador de EJB3."#: index.docbook:100msgid """<literal>persist()</literal> makes a transient instance persistent. However, ""it doesn't guarantee that the identifier value will be assigned to the ""persistent instance immediately, the assignment might happen at flush time. ""<literal>persist()</literal> also guarantees that it will not execute an ""<literal>INSERT</literal> statement if it is called outside of transaction ""boundaries. This is useful in long-running conversations with an extended ""Session/persistence context."msgstr """UNTRANSLATED!!! <literal>persist()</literal> makes a transient instance ""persistent. However, it doesn't guarantee that the identifier value will be ""assigned to the persistent instance immediately, the assignment might happen ""at flush time. <literal>persist()</literal> also guarantees that it will not ""execute an <literal>INSERT</literal> statement if it is called outside of ""transaction boundaries. This is useful in long-running conversations with an ""extended Session/persistence context."#: index.docbook:111msgid """<literal>save()</literal> does guarantee to return an identifier. If an ""INSERT has to be executed to get the identifier ( e.g. \"identity\" ""generator, not \"sequence\"), this INSERT happens immediately, no matter if ""you are inside or outside of a transaction. This is problematic in a long-""running conversation with an extended Session/persistence context."msgstr """<literal>save()</literal> does guarantee to return an identifier. If an ""INSERT has to be executed to get the identifier ( e.g. \"identity\" ""generator, not \"sequence\"), this INSERT happens immediately, no matter if ""you are inside or outside of a transaction. This is problematic in a long-""running conversation with an extended Session/persistence context."#: index.docbook:121msgid """Alternatively, you may assign the identifier using an overloaded version of ""<literal>save()</literal>."msgstr """Alternativamente, puedes asignar el identificador usando una versión ""sobrecargada de <literal>save()</literal>."#: index.docbook:126msgid """<![CDATA[DomesticCat pk = new DomesticCat();\n""pk.setColor(Color.TABBY);\n""pk.setSex('F');\n""pk.setName(\"PK\");\n""pk.setKittens( new HashSet() );\n""pk.addKitten(fritz);\n""sess.save( pk, new Long(1234) );]]>"msgstr """<![CDATA[DomesticCat pk = new DomesticCat();\n""pk.setColor(Color.TABBY);\n""pk.setSex('F');\n""pk.setName(\"PK\");\n""pk.setKittens( new HashSet() );\n""pk.addKitten(fritz);\n""sess.save( pk, new Long(1234) );]]>"#: index.docbook:128msgid """If the object you make persistent has associated objects (e.g. the ""<literal>kittens</literal> collection in the previous example), these ""objects may be made persistent in any order you like unless you have a ""<literal>NOT NULL</literal> constraint upon a foreign key column. There is ""never a risk of violating foreign key constraints. However, you might ""violate a <literal>NOT NULL</literal> constraint if you <literal>save()</""literal> the objects in the wrong order."msgstr """Si el objeto que haces persistente tiene objetos asociados (por ejemplo, la ""colección <literal>kittens</literal> en el ejemplo anterior), estos ""objetos pueden ser hechos persistentes en cualquier orden que quieras a ""menos que tengas una restricción <literal>NOT NULL</literal> sobre ""una columna clave foránea. Nunca hay riesgo de violar restricciones ""de clave foránea. Sin embargo, podrías violar una ""restricción <literal>NOT NULL</literal> si llamas a <literal>save()</""literal> sobre objetos en orden erróneo."#: index.docbook:138msgid """Usually you don't bother with this detail, as you'll very likely use ""Hibernate's <emphasis>transitive persistence</emphasis> feature to save the ""associated objects automatically. Then, even <literal>NOT NULL</literal> ""constraint violations don't occur - Hibernate will take care of everything. ""Transitive persistence is discussed later in this chapter."msgstr """Usualmente no te preocupas con este detalle, pues muy probablemente ""usarás la funcionalidad de <emphasis>persistencia transitiva</""emphasis> de Hibernate para salvar los objetos asociados automá""ticamente. Entonces, ni siquiera ocurren violaciones de restricciones ""<literal>NOT NULL</literal> - Hibernate cuidará de todo. La ""persistencia transitiva se discute más adelante en este capí""tulo."#: index.docbook:149msgid "Loading an object"msgstr "Cargando un objeto"#: index.docbook:151msgid """The <literal>load()</literal> methods of <literal>Session</literal> gives ""you a way to retrieve a persistent instance if you already know its ""identifier. <literal>load()</literal> takes a class object and will load the ""state into a newly instantiated instance of that class, in persistent state."msgstr """Los métodos <literal>load()</literal> de <literal>Session</literal> ""te brindan una forma de traer una instancia persistente si ya saves su ""identificador. <literal>load()</literal> toma un objeto clase y ""cargará el estado dentro de una instancia recién instanciada ""de esta clase, en estado persistente."#: index.docbook:158msgid "<![CDATA[Cat fritz = (Cat) sess.load(Cat.class, generatedId);]]>"msgstr "<![CDATA[Cat fritz = (Cat) sess.load(Cat.class, generatedId);]]>"#: index.docbook:160msgid """<![CDATA[// you need to wrap primitive identifiers\n""long id = 1234;\n""DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long""(id) );]]>"msgstr """<![CDATA[// you need to wrap primitive identifiers\n""long id = 1234;\n""DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long""(id) );]]>"#: index.docbook:162msgid "Alternatively, you can load state into a given instance:"msgstr "Alternativamente, puedes cargar estado dentro de una instancia dada:"#: index.docbook:166msgid """<![CDATA[Cat cat = new DomesticCat();\n""// load pk's state into cat\n""sess.load( cat, new Long(pkId) );\n""Set kittens = cat.getKittens();]]>"msgstr """<![CDATA[Cat cat = new DomesticCat();\n""// load pk's state into cat\n""sess.load( cat, new Long(pkId) );\n""Set kittens = cat.getKittens();]]>"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -