alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (session_api.po)

This example Hibernate source code file (session_api.po) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

api, cat, cat, hibernate, hibernate, if, las, si, sql, sql, tag, tag, the, this

The Hibernate session_api.po source code

# translation of session_api.po to
# Michael H. Smith <mhideo@redhat.com>, 2007.
# Angela Garcia <agarcia@redhat.com>, 2009, 2010.
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
# translation of Collection_Mapping.po to
msgid ""
msgstr ""
"Project-Id-Version: session_api\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-21 05:43+0000\n"
"PO-Revision-Date: 2010-03-15 14:40+1000\n"
"Last-Translator: Angela Garcia <agarcia@redhat.com>\n"
"Language-Team:  <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"

#. Tag: title
#: session_api.xml:31
#, no-c-format
msgid "Working with objects"
msgstr "Trabajo con objetos"

#. Tag: para
#: session_api.xml:33
#, no-c-format
msgid ""
"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 of objects. This is, "
"contrary to the management of SQL <literal>statements in common "
"JDBC/SQL persistence layers, a natural object-oriented view of persistence "
"in Java applications."
msgstr ""
"Hibernate es una solución completa de mapeo objeto/relacional que no sólo "
"proteje al desarrollador de los detalles del sistema de administración de la "
"base datos subyacente, sino que además ofrece <emphasis>administración de "
"estado</emphasis> de objetos. Contrario a la administración de "
"<literal>declaraciones SQL en capas comunes de persistencia JDBC/"
"SQL, esta es una vista natural orientada a objetos de la persistencia en "
"aplicaciones Java."

#. Tag: para
#: session_api.xml:40
#, no-c-format
msgid ""
"In other words, Hibernate application developers should always think about "
"the <emphasis>state 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 desarrolladores de aplicaciones de Hibernate siempre "
"deben pensar en el <emphasis>estado de sus objetos, y no "
"necesariamente en la ejecución de declaraciones SQL. Hibernate se ocupa de "
"esto y es sólamente relevante para el desarrollador de la aplicación al "
"afinar el rendimiento del sistema."

#. Tag: title
#: session_api.xml:47
#, no-c-format
msgid "Hibernate object states"
msgstr "Estados de objeto de Hibernate"

#. Tag: para
#: session_api.xml:49
#, no-c-format
msgid "Hibernate defines and supports the following object states:"
msgstr "Hibernate define y soporta los siguientes estados de objeto:"

#. Tag: para
#: session_api.xml:53
#, no-c-format
msgid ""
"<emphasis>Transient - an object is transient if it has just been "
"instantiated using the <literal>new operator, and it is not "
"associated with a Hibernate <literal>Session. 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 does not hold a reference anymore. Use the Hibernate "
"<literal>Session 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 - un objeto es transitorio si ha sido "
"recién instanciado utilizando el operador <literal>new, y no está "
"asociado a una <literal>Session 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. "
"Utiliza la <literal>Session de Hibernate para hacer un objeto "
"persistente (y deja que Hibernate se ocupe de las declaraciones SQL que "
"necesitan ejecutarse para esta transición)."

#. Tag: para
#: session_api.xml:65
#, no-c-format
msgid ""
"<emphasis>Persistent - 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 "
"statements, or <literal>DELETE statements when an object should be "
"made transient."
msgstr ""
"<emphasis>Persistente - una instancia persistente tiene una "
"representación en la base de datos y un valor identificador. Puede haber "
"sido guardado o cargado, sin embargo, por definición, se encuentra en el "
"ámbito de una <literal>Session. Hibernate detectará cualquier "
"cambio realizado a un objeto en estado persistente y sincronizará el estado "
"con la base de datos cuando se complete la unidad de trabajo. Los "
"desarrolladores no ejecutan declaraciones <literal>UPDATE "
"manuales, o declaraciones <literal>DELETE cuando un objeto se debe "
"poner como transitorio."

#. Tag: para
#: session_api.xml:77
#, no-c-format
msgid ""
"<emphasis>Detached - a detached instance is an object that has "
"been persistent, but its <literal>Session 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 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, i.e., a unit of work "
"from the point of view of the user."
msgstr ""
"<emphasis>Separado - una instancia separada es un objeto que se "
"ha hecho persistente, pero su <literal>Session 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 más "
"tarde, 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 por parte del usuario. Las "
"llamamos <emphasis>transaccciones de aplicación, por ejemplo, una "
"unidad de trabajo desde el punto de vista del usuario."

#. Tag: para
#: session_api.xml:90
#, no-c-format
msgid ""
"We will 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. "

#. Tag: title
#: session_api.xml:95
#, no-c-format
msgid "Making objects persistent"
msgstr "Haciendo los objetos persistentes"

#. Tag: para
#: session_api.xml:97
#, no-c-format
msgid ""
"Newly instantiated instances of a persistent class are considered "
"<emphasis>transient by Hibernate. We can make a transient "
"instance <emphasis>persistent by associating it with a session:"
msgstr ""
"Las instancias recién instanciadas de una clase persistente, Hibernate las "
"considera como <emphasis>transitorias. Podemos hacer una "
"instancia transitoria <emphasis>persistente asociándola con una "
"sesión:"

#. Tag: programlisting
#: session_api.xml:102
#, no-c-format
msgid ""
"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 ""

#. Tag: para
#: session_api.xml:104
#, no-c-format
msgid ""
"If <literal>Cat has a generated identifier, the identifier is "
"generated and assigned to the <literal>cat when save()Cat has an assigned instance before calling save()persist() instead of "
"<literal>save(), with the semantics defined in the EJB3 early "
"draft."
msgstr ""
"Si <literal>Cat tiene un identificador generado, el identificador "
"es generado y asignado al <literal>cat cuando se llama a "
"<literal>save(). Si Cat tiene un identificador "
"<literal>assigned, o una clave compuesta, el identificador debe "
"ser asignado a la instancia de <literal>cat antes de llamar a "
"<literal>save(). También puede utilizar persist()save(), con la semántica definida en "
"el borrador de EJB3. "

#. Tag: para
#: session_api.xml:115
#, no-c-format
msgid ""
"<literal>persist() makes a transient instance persistent. However, "
"it does not guarantee that the identifier value will be assigned to the "
"persistent instance immediately, the assignment might happen at flush time. "
"<literal>persist() also guarantees that it will not execute an "
"<literal>INSERT statement if it is called outside of transaction "
"boundaries. This is useful in long-running conversations with an extended "
"Session/persistence context."
msgstr ""
"<literal>persist() hace que una instancia transitoria sea "
"persistente. Sin embargo, no garantiza que el valor identificador sea "
"asignado a la instancia persistente inmediatamente, la tarea puede tener "
"lugar durante el vaciado. <literal>persist() también garantiza que "
"no ejecutará una declaración <literal>INSERT si se llama por fuera "
"de los límites de una transacción. Esto es útil en conversaciones largas con "
"un contexto extendido sesión/persistencia."

#. Tag: para
#: session_api.xml:126
#, no-c-format
msgid ""
"<literal>save() 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() sí garantiza el retorno de un identificador. Si se "
"tiene que ejecutar un INSERT para obtener el identificador ( por ejemplo, "
"generador \"identidad\", no \"secuencia\"), este INSERT tiene lugar "
"inmediatamente sin importar si se encuentra dentro o fuera de una "
"transacción. Esto es problemático en una conversación larga con un contexto "
"extendido sesión/persistencia."

#. Tag: para
#: session_api.xml:135
#, no-c-format
msgid ""
"Alternatively, you can assign the identifier using an overloaded version of "
"<literal>save()."
msgstr ""
"Opcionalmente, puede asignar el identificador utilizando una versión "
"sobrecargada de <literal>save()."

#. Tag: programlisting
#: session_api.xml:138
#, no-c-format
msgid ""
"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 ""

#. Tag: para
#: session_api.xml:140
#, no-c-format
msgid ""
"If the object you make persistent has associated objects (e.g. the "
"<literal>kittens collection in the previous example), these "
"objects can be made persistent in any order you like unless you have a "
"<literal>NOT NULL constraint upon a foreign key column. There is "
"never a risk of violating foreign key constraints. However, you might "
"violate a <literal>NOT NULL constraint if you save() en el ejemplo anterior), estos objetos "
"pueden ser hechos persistentes en cualquier orden que quiera a menos de que "
"tenga una restricción <literal>NOT NULL sobre una columna clave "
"foránea. Nunca hay riesgo de violar restricciones de clave foránea. Sin "
"embargo, puede que usted viole una restricción <literal>NOT NULL "
"si llama a <literal>save() sobre los objetos en el orden "
"equivocado. "

#. Tag: para
#: session_api.xml:148
#, no-c-format
msgid ""
"Usually you do not bother with this detail, as you will normally use "
"Hibernate's <emphasis>transitive persistence feature to save the "
"associated objects automatically. Then, even <literal>NOT NULL "
"constraint violations do not occur - Hibernate will take care of everything. "
"Transitive persistence is discussed later in this chapter."
msgstr ""
"Usualmente no se preocupe de este detalle, pues muy probablemente utilizará "
"la funcionalidad de <emphasis>persistencia transitiva de "
"Hibernate para guardar los objetos asociados automáticamente. Entonces, ni "
"siquiera tienen lugar violaciones de restricciones <literal>NOT NULL methods of Session provide "
"a way of retrieving a persistent instance if you know its identifier. "
"<literal>load() takes a class object and loads the state into a "
"newly instantiated instance of that class in a persistent state."
msgstr ""
"Los métodos <literal>load() de Session le "
"proporcionan una forma de recuperar una instancia persistente si ya conoce "
"su identificador. <literal>load() toma un objeto clase y carga el "
"estado dentro de una instancia recién instanciada de esa clase, en un estado "
"persistente."

#. Tag: programlisting
#: session_api.xml:165
#, no-c-format
msgid "Cat fritz = (Cat) sess.load(Cat.class, generatedId);"
msgstr ""

#. Tag: programlisting
#: session_api.xml:167
#, no-c-format
msgid ""
"// you need to wrap primitive identifiers\n"
"long id = 1234;\n"
"DomesticCat pk = (DomesticCat) sess.load( DomesticCat.class, new Long(id) );"
msgstr ""

#. Tag: para
#: session_api.xml:169
#, no-c-format
msgid "Alternatively, you can load state into a given instance:"
msgstr "Alternativamente, puede cargar estado dentro de una instancia dada:"

#. Tag: programlisting
#: session_api.xml:171
#, no-c-format
msgid ""
"Cat cat = new DomesticCat();\n"
"// load pk's state into cat\n"
"sess.load( cat, new Long(pkId) );\n"
"Set kittens = cat.getKittens();"
msgstr ""

#. Tag: para
#: session_api.xml:173
#, no-c-format
msgid ""
"Be aware that <literal>load() will throw an unrecoverable "
"exception if there is no matching database row. If the class is mapped with "
"a proxy, <literal>load() just returns an uninitialized proxy and "
"does not actually hit the database until you invoke a method of the proxy. "
"This is useful if you wish to create an association to an object without "
"actually loading it from the database. It also allows multiple instances to "
"be loaded as a batch if <literal>batch-size is defined for the "
"class mapping."
msgstr ""
"Note que <literal>load() lanzará una excepción irrecuperable si no "
"hay una fila correspondiente en la base de datos. Si la clase se mapea con "
"un proxy, <literal>load() sólo retorna un proxy no inicializado y "
"no llamará realmente a la base de datos hasta que invoque un método del "
"proxy. Este comportamiento es muy útil si desea crear una asociación a un "
"objeto sin cargarlo realmente de la base de datos. Además permite que "
"múltiples instancias sean cargadas como un lote si se define <literal>batch-"
"size</literal> para el mapeo de la clase."

#. Tag: para
#: session_api.xml:182
#, no-c-format
msgid ""
"If you are not certain that a matching row exists, you should use the "
"<literal>get() method which hits the database immediately and "
"returns null if there is no matching row."
msgstr ""
"Si no tiene la certeza de que existe una fila correspondiente, debe utilizar "
"el método <literal>get(), que llama a la base de datos "
"inmediatamente y devuelve nulo si no existe una fila correspondiente. "

#. Tag: programlisting
#: session_api.xml:186
#, no-c-format
msgid ""
"Cat cat = (Cat) sess.get(Cat.class, id);\n"
"if (cat==null) {\n"
"    cat = new Cat();\n"
"    sess.save(cat, id);\n"
"}\n"
"return cat;"
msgstr ""

#. Tag: para
#: session_api.xml:188
#, no-c-format
msgid ""
"You can even load an object using an SQL <literal>SELECT ... FOR UPDATELockMode. See the API documentation for "
"more information."
msgstr ""
"Incluso puede cargar un objeto utilizando un <literal>SELECT ... FOR UPDATELockMode. Consulte la "
"documentación de la API para obtener más información."

#. Tag: programlisting
#: session_api.xml:192
#, no-c-format
msgid "Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);"
msgstr ""

#. Tag: para
#: session_api.xml:194
#, no-c-format
msgid ""
"Any associated instances or contained collections will <emphasis>notFOR UPDATE, unless you decide to "
"specify <literal>lock or all as a cascade style "
"for the association."
msgstr ""
"<emphasis>Ninguna instancia asociada o colección contenida es "
"seleccionada para actualizacion - <literal>FOR UPDATE, a menos de "
"que decida especificar <literal>lock o all como "
"un estilo de cascada para la asociación."

#. Tag: para
#: session_api.xml:199
#, no-c-format
msgid ""
"It is possible to re-load an object and all its collections at any time, "
"using the <literal>refresh() method. This is useful when database "
"triggers are used to initialize some of the properties of the object."
msgstr ""
"Es posible volver a cargar un objeto y todas sus colecciones en cualquier "
"momento, utilizando el método <literal>refresh(). Esto es útil "
"cuando se usan disparadores de base de datos para inicializar algunas de las "
"propiedades del objeto."

#. Tag: programlisting
#: session_api.xml:204
#, no-c-format
msgid ""
"sess.save(cat);\n"
"sess.flush(); //force the SQL INSERT\n"
"sess.refresh(cat); //re-read the state (after the trigger executes)"
msgstr ""

#. Tag: para
#: session_api.xml:206
#, fuzzy, no-c-format
msgid ""
"How much does Hibernate load from the database and how many SQL "
"<literal>SELECTs will it use? This depends on the "
"<emphasis>fetching strategy. This is explained in estrategia de "
"recuperación</emphasis>. Esto se explica en la  using the current Session. Esta interfaz ofrece métodos para "
"ligar parámetros, manejo del conjunto resultado, y para la ejecución de la "
"consulta real. Siempre obtiene una <literal>Query utilizando la "
"<literal>Session actual:"

#. Tag: programlisting
#: session_api.xml:232
#, no-c-format
msgid ""
"List cats = session.createQuery(\n"
"    \"from Cat as cat where cat.birthdate < ?\")\n"
"    .setDate(0, date)\n"
"    .list();\n"
"\n"
"List mothers = session.createQuery(\n"
"    \"select mother from Cat as cat join cat.mother as mother where cat.name "
"= ?\")\n"
"    .setString(0, name)\n"
"    .list();\n"
"\n"
"List kittens = session.createQuery(\n"
"    \"from Cat as cat where cat.mother = ?\")\n"
"    .setEntity(0, pk)\n"
"    .list();\n"
"\n"
"Cat mother = (Cat) session.createQuery(\n"
"    \"select cat.mother from Cat as cat where cat = ?\")\n"
"    .setEntity(0, izi)\n"
"    .uniqueResult();]]\n"
"\n"
"Query mothersWithKittens = (Cat) session.createQuery(\n"
"    \"select mother from Cat as mother left join fetch mother.kittens\");\n"
"Set uniqueMothers = new HashSet(mothersWithKittens.list());"
msgstr ""

#. Tag: para
#: session_api.xml:234
#, no-c-format
msgid ""
"A query is usually executed by invoking <literal>list(). The "
"result of the query will be loaded completely into a collection in memory. "
"Entity instances retrieved by a query are in a persistent state. The "
"<literal>uniqueResult() method offers a shortcut if you know your "
"query will only return a single object. Queries that make use of eager "
"fetching of collections usually return duplicates of the root objects, but "
"with their collections initialized. You can filter these duplicates through "
"a <literal>Set."
msgstr ""
"Una consulta se ejecuta usualmente invocando a <literal>list(). El "
"resultado de la consulta será cargado completamente dentro de una colección "
"en memoria. Las instancias de entidad recuperadas por una consulta se "
"encuentran en estado persistente. El método <literal>uniqueResult()."

#. Tag: title
#: session_api.xml:244
#, no-c-format
msgid "Iterating results"
msgstr "Iteración de resultados"

#. Tag: para
#: session_api.xml:246
#, no-c-format
msgid ""
"Occasionally, you might be able to achieve better performance by executing "
"the query using the <literal>iterate() method. This will usually "
"be the case if you expect that the actual entity instances returned by the "
"query will already be in the session or second-level cache. If they are not "
"already cached, <literal>iterate() will be slower than "
"<literal>list() and might require many database hits for a simple "
"query, usually <emphasis>1 for the initial select which only "
"returns identifiers, and <emphasis>n additional selects to "
"initialize the actual instances."
msgstr ""
"Ocasionalmente, puede lograr un mejor rendimiento al ejecutar la consulta "
"utilizando el método <literal>iterate(). Esto ocurrirá usualmente "
"si espera que las instancias reales de entidad retornadas por la consulta "
"estén ya en la sesión o en el caché de segundo nivel. Si todavía no están en "
"caché, <literal>iterate() será más lento que list() para la selección inicial "
"que sólamente retorna identificadores y <emphasis>n selecciones "
"adicionales para inicializar las instancias reales."

#. Tag: programlisting
#: session_api.xml:257
#, no-c-format
msgid ""
"// fetch ids\n"
"Iterator iter = sess.createQuery(\"from eg.Qux q order by q.likeliness\")."
"iterate();\n"
"while ( iter.hasNext() ) {\n"
"    Qux qux = (Qux) iter.next();  // fetch the object\n"
"    // something we couldnt express in the query\n"
"    if ( qux.calculateComplicatedAlgorithm() ) {\n"
"        // delete the current instance\n"
"        iter.remove();\n"
"        // dont need to process the rest\n"
"        break;\n"
"    }\n"
"}"
msgstr ""

#. Tag: title
#: session_api.xml:261
#, no-c-format
msgid "Queries that return tuples"
msgstr "Consultas que devuelven tuplas"

#. Tag: para
#: session_api.xml:263
#, no-c-format
msgid ""
"Hibernate queries sometimes return tuples of objects. Each tuple is returned "
"as an array:"
msgstr ""
"Las consultas de Hibernate a veces retornan tuplas de objetos. Cada tupla se "
"retorna como un array:"

#. Tag: programlisting
#: session_api.xml:266
#, no-c-format
msgid ""
"Iterator kittensAndMothers = sess.createQuery(\n"
"            \"select kitten, mother from Cat kitten join kitten.mother mother"
"\")\n"
"            .list()\n"
"            .iterator();\n"
"\n"
"while ( kittensAndMothers.hasNext() ) {\n"
"    Object[] tuple = (Object[]) kittensAndMothers.next();\n"
"    Cat kitten = (Cat) tuple[0];\n"
"    Cat mother = (Cat) tuple[1];\n"
"    ....\n"
"}"
msgstr ""

#. Tag: title
#: session_api.xml:270
#, no-c-format
msgid "Scalar results"
msgstr "Resultados escalares"

#. Tag: para
#: session_api.xml:272
#, no-c-format
msgid ""
"Queries can specify a property of a class in the <literal>select "
"clause. They can even call SQL aggregate functions. Properties or aggregates "
"are considered \"scalar\" results and not entities in persistent state."
msgstr ""
"Las consultas pueden especificar una propiedad de una clase en la cláusula "
"<literal>select. Pueden incluso llamar a funciones de agregación "
"SQL. Las propiedades o agregaciones son considerados resultados \"escalares"
"\" y no entidades en estado persistente."

#. Tag: programlisting
#: session_api.xml:277
#, no-c-format
msgid ""
"Iterator results = sess.createQuery(\n"
"        \"select cat.color, min(cat.birthdate), count(cat) from Cat cat \" "
"+\n"
"        \"group by cat.color\")\n"
"        .list()\n"
"        .iterator();\n"
"\n"
"while ( results.hasNext() ) {\n"
"    Object[] row = (Object[]) results.next();\n"
"    Color type = (Color) row[0];\n"
"    Date oldest = (Date) row[1];\n"
"    Integer count = (Integer) row[2];\n"
"    .....\n"
"}"
msgstr ""

#. Tag: title
#: session_api.xml:281
#, no-c-format
msgid "Bind parameters"
msgstr "Ligado de parámetros"

#. Tag: para
#: session_api.xml:283
#, no-c-format
msgid ""
"Methods on <literal>Query are provided for binding values to named "
"parameters or JDBC-style <literal>? parameters. Contrary "
"to JDBC, Hibernate numbers parameters from zero.</emphasis> Named parameters "
"are identifiers of the form <literal>:name in the query string. "
"The advantages of named parameters are as follows:"
msgstr ""
"Los métodos en <literal>Query se proporcionan para enlazar valores "
"a los parámetros con nombre o parámetros <literal>? de estilo "
"JDBC. <emphasis>Al contrario de JDBC, Hibernate numera los parámetros desde "
"cero.</emphasis> Los parámetros con nombre son identificadores de la forma "
"<literal>:name en la cadena de la consulta. Las ventajas de los "
"parámetros con nombre son las siguientes:"

#. Tag: para
#: session_api.xml:292
#, no-c-format
msgid ""
"named parameters are insensitive to the order they occur in the query string"
msgstr ""
"los parámetros con nombre son insensibles al orden en que aparecen en la "
"cadena de consulta"

#. Tag: para
#: session_api.xml:297
#, no-c-format
msgid "they can occur multiple times in the same query"
msgstr "pueden aparecer múltiples veces en la misma petición"

#. Tag: para
#: session_api.xml:301
#, no-c-format
msgid "they are self-documenting"
msgstr "son auto-documentados"

#. Tag: programlisting
#: session_api.xml:305
#, no-c-format
msgid ""
"//named parameter (preferred)\n"
"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = :name"
"\");\n"
"q.setString(\"name\", \"Fritz\");\n"
"Iterator cats = q.iterate();"
msgstr ""

#. Tag: programlisting
#: session_api.xml:307
#, no-c-format
msgid ""
"//positional parameter\n"
"Query q = sess.createQuery(\"from DomesticCat cat where cat.name = ?\");\n"
"q.setString(0, \"Izi\");\n"
"Iterator cats = q.iterate();"
msgstr ""

#. Tag: programlisting
#: session_api.xml:309
#, no-c-format
msgid ""
"//named parameter list\n"
"List names = new ArrayList();\n"
"names.add(\"Izi\");\n"
"names.add(\"Fritz\");\n"
"Query q = sess.createQuery(\"from DomesticCat cat where cat.name in (:"
"namesList)\");\n"
"q.setParameterList(\"namesList\", names);\n"
"List cats = q.list();"
msgstr ""

#. Tag: title
#: session_api.xml:313
#, no-c-format
msgid "Pagination"
msgstr "Paginación"

#. Tag: para
#: session_api.xml:315
#, no-c-format
msgid ""
"If you need to specify bounds upon your result set, that is, the maximum "
"number of rows you want to retrieve and/or the first row you want to "
"retrieve, you can use methods of the <literal>Query interface:"
msgstr ""
"Si necesita especificar enlaces sobre su conjunto de resultados, el número "
"máximo de filas que quiere recuperar y/o la primera fila que quiere "
"recuperar, puede utilizar los métodos de la interfaz <literal>Querys, the "
"<literal>Query interface can be used to obtain a "
"<literal>ScrollableResults object that allows flexible navigation "
"of the query results."
msgstr ""
"Si su controlador JDBC soporta <literal>ResultSets deslizables, la "
"interfaz <literal>Query se puede utilizar para obtener un objeto "
"<literal>ScrollableResults que permite una navegación flexible de "
"los resultados de consulta. "

#. Tag: programlisting
#: session_api.xml:334
#, no-c-format
msgid ""
"Query q = sess.createQuery(\"select cat.name, cat from DomesticCat cat \" +\n"
"                            \"order by cat.name\");\n"
"ScrollableResults cats = q.scroll();\n"
"if ( cats.first() ) {\n"
"\n"
"    // find the first name on each page of an alphabetical list of cats by "
"name\n"
"    firstNamesOfPages = new ArrayList();\n"
"    do {\n"
"        String name = cats.getString(0);\n"
"        firstNamesOfPages.add(name);\n"
"    }\n"
"    while ( cats.scroll(PAGE_SIZE) );\n"
"\n"
"    // Now get the first page of cats\n"
"    pageOfCats = new ArrayList();\n"
"    cats.beforeFirst();\n"
"    int i=0;\n"
"    while( ( PAGE_SIZE > i++ ) && cats.next() ) pageOfCats.add"
"( cats.get(1) );\n"
"\n"
"}\n"
"cats.close()"
msgstr ""

#. Tag: para
#: session_api.xml:336
#, no-c-format
msgid ""
"Note that an open database connection and cursor is required for this "
"functionality. Use <literal>setMaxResult()/setFirstResult"
"()</literal> if you need offline pagination functionality."
msgstr ""
"Note que se requiere una conexión de base de datos abierta y un cursor para "
"esta funcionalidad. Utilice <literal>setMaxResult()/"
"<literal>setFirstResult() si necesita la funcionalidad de "
"paginación fuera de línea."

#. Tag: title
#: session_api.xml:343
#, no-c-format
msgid "Externalizing named queries"
msgstr "Externalización de consultas con nombre"

#. Tag: para
#: session_api.xml:345
#, no-c-format
msgid ""
"Queries can also be configured as so called named queries using annotations "
"or Hibernate mapping documents. <literal>@NamedQuery and "
"<literal>@NamedQueries can be defined at the class level as seen "
"in <xref linkend=\"example-named-query-annotation\"/> . However their "
"definitions are global to the session factory/entity manager factory scope. "
"A named query is defined by its name and the actual query string."
msgstr ""

#. Tag: title
#: session_api.xml:355
#, no-c-format
msgid "Defining a named query using <classname>@NamedQuery"
msgstr ""

#. Tag: programlisting
#: session_api.xml:358
#, no-c-format
msgid ""
"@Entity\n"
"@NamedQuery(name=\"night.moreRecentThan\", query=\"select n from Night n "
"where n.date >= :date\")\n"
"public class Night {\n"
"    ...\n"
"}\n"
"\n"
"public class MyDao {\n"
"    doStuff() {\n"
"        Query q = s.getNamedQuery(\"night.moreRecentThan\");\n"
"        q.setDate( \"date\", aMonthAgo );\n"
"        List results = q.list();\n"
"        ...\n"
"    }\n"
"    ...\n"
"}"
msgstr ""

#. Tag: para
#: session_api.xml:361
#, fuzzy, no-c-format
msgid ""
"Using a mapping document can be configured using the <literal><query>CDATA section if your "
"query contains characters that could be interpreted as markup."
msgstr ""
"También puede definir consultas con nombre en el documento de mapeo. "
"Recuerde utilizar una sección <literal>CDATA si su consulta "
"contiene caracteres que puedan ser interpretados como etiquetado."

#. Tag: title
#: session_api.xml:367
#, no-c-format
msgid "Defining a named query using <literal><query>"
msgstr ""

#. Tag: programlisting
#: session_api.xml:370
#, no-c-format
msgid ""
"<query name=\"ByNameAndMaximumWeight\"><![CDATA[\n"
"    from eg.DomesticCat as cat\n"
"        where cat.name = ?\n"
"        and cat.weight > ?\n"
"] ]></query>"
msgstr ""

#. Tag: para
#: session_api.xml:373
#, fuzzy, no-c-format
msgid ""
"Parameter binding and executing is done programatically as seen in <xref "
"linkend=\"example-parameter-binding-named-query\"/>."
msgstr "El ligado de parámetros y de ejecución se realiza programáticamente:"

#. Tag: title
#: session_api.xml:377
#, no-c-format
msgid "Parameter binding of a named query"
msgstr ""

#. Tag: programlisting
#: session_api.xml:379
#, no-c-format
msgid ""
"Query q = sess.getNamedQuery(\"ByNameAndMaximumWeight\");\n"
"q.setString(0, name);\n"
"q.setInt(1, minWeight);\n"
"List cats = q.list();"
msgstr ""

#. Tag: para
#: session_api.xml:382
#, no-c-format
msgid ""
"The actual program code is independent of the query language that is used. "
"You can also define native SQL queries in metadata, or migrate existing "
"queries to Hibernate by placing them in mapping files."
msgstr ""
"El código real del programa es independiente del lenguaje de consulta "
"utilizado. También puede definir consultas SQL nativas en metadatos, o "
"migrar consultas existentes a Hibernate colocándolas en archivos de mapeo."

#. Tag: para
#: session_api.xml:387
#, no-c-format
msgid ""
"Also note that a query declaration inside a <literal><hibernate-"
"mapping></literal> element requires a global unique name for the query, "
"while a query declaration inside a <literal><class> element "
"is made unique automatically by prepending the fully qualified name of the "
"class. For example <literal>eg.Cat.ByNameAndMaximumWeight."
msgstr ""
"Observe además que una declaración de consulta dentro de un elemento "
"<literal><hibernate-mapping> necesita de un nombre único "
"global para la consulta, mientras que una declaración de consulta dentro de "
"un elemento <literal><class> se hace única automáticamente "
"al agregar el nombre completamente calificado de la clase. Por ejemplo, "
"<literal>eg.Cat.ByNameAndMaximumWeight."

#. Tag: title
#: session_api.xml:397
#, no-c-format
msgid "Filtering collections"
msgstr "Filtración de colecciones"

#. Tag: para
#: session_api.xml:399
#, no-c-format
msgid ""
"A collection <emphasis>filter is a special type of query that can "
"be applied to a persistent collection or array. The query string can refer "
"to <literal>this, meaning the current collection element."
msgstr ""
"Un <emphasis>filtro de colección es un tipo especial de consulta "
"que puede ser aplicado a una colección persistente o array. La cadena de "
"consulta puede referirse a <literal>this, lo que quiere decir el "
"elemento de la colección actual."

#. Tag: programlisting
#: session_api.xml:404
#, no-c-format
msgid ""
"Collection blackKittens = session.createFilter(\n"
"    pk.getKittens(), \n"
"    \"where this.color = ?\")\n"
"    .setParameter( Color.BLACK, Hibernate.custom(ColorUserType.class) )\n"
"    .list()\n"
");"
msgstr ""

#. Tag: para
#: session_api.xml:406
#, no-c-format
msgid ""
"The returned collection is considered a bag that is a copy of the given "
"collection. The original collection is not modified. This is contrary to the "
"implication of the name \"filter\", but consistent with expected behavior."
msgstr ""
"La colección devuelta es considerada un bag, y es una copia de la colección "
"dada. La colección original no es modificada. Esto es lo opuesto a lo que "
"implica el nombre \"filtro\", pero es consistente con el comportamiento "
"esperado."

#. Tag: para
#: session_api.xml:411
#, no-c-format
msgid ""
"Observe that filters do not require a <literal>from clause, "
"although they can have one if required. Filters are not limited to returning "
"the collection elements themselves."
msgstr ""
"Observe que los filtros no requieren una cláusula <literal>from "
"aunque pueden tener una si se necesita. Los filtros no están limitados a "
"devolver los elementos de colección por sí mismos."

#. Tag: programlisting
#: session_api.xml:415
#, no-c-format
msgid ""
"Collection blackKittenMates = session.createFilter(\n"
"    pk.getKittens(), \n"
"    \"select this.mate where this.color = eg.Color.BLACK.intValue\")\n"
"    .list();"
msgstr ""

#. Tag: para
#: session_api.xml:417
#, no-c-format
msgid ""
"Even an empty filter query is useful, e.g. to load a subset of elements in a "
"large collection:"
msgstr ""
"Incluso una consulta de filtro vacío es útil, por ejemplo, para cargar un "
"subconjunto de elementos en una colección enorme: "

#. Tag: programlisting
#: session_api.xml:420
#, no-c-format
msgid ""
"Collection tenKittens = session.createFilter(\n"
"    mother.getKittens(), \"\")\n"
"    .setFirstResult(0).setMaxResults(10)\n"
"    .list();"
msgstr ""

#. Tag: title
#: session_api.xml:424
#, no-c-format
msgid "Criteria queries"
msgstr "Consultas de criterios"

#. Tag: para
#: session_api.xml:426
#, no-c-format
msgid ""
"HQL is extremely powerful, but some developers prefer to build queries "
"dynamically using an object-oriented API, rather than building query "
"strings. Hibernate provides an intuitive <literal>Criteria query "
"API for these cases:"
msgstr ""
"HQL es extremadamente potente pero algunos desarrolladores prefieren "
"construir consultas dinámicamente utilizando una API orientada a objetos, en "
"vez de construir cadenas de consulta. Hibernate brinda una API intuitiva de "
"consulta <literal>Criteria para estos casos: "

#. Tag: programlisting
#: session_api.xml:431
#, no-c-format
msgid ""
"Criteria crit = session.createCriteria(Cat.class);\n"
"crit.add( Restrictions.eq( \"color\", eg.Color.BLACK ) );\n"
"crit.setMaxResults(10);\n"
"List cats = crit.list();"
msgstr ""

#. Tag: para
#: session_api.xml:433
#, fuzzy, no-c-format
msgid ""
"The <literal>Criteria and the associated Example y el Example "
"asociado se discuten en más detalle en el <xref linkend=\"querycriteria\" />."

#. Tag: title
#: session_api.xml:439
#, no-c-format
msgid "Queries in native SQL"
msgstr "Consultas en SQL nativo"

#. Tag: para
#: session_api.xml:441
#, no-c-format
msgid ""
"You can express a query in SQL, using <literal>createSQLQuery() "
"and let Hibernate manage the mapping from result sets to objects. You can at "
"any time call <literal>session.connection() and use the JDBC "
"<literal>Connection directly. If you choose to use the Hibernate "
"API, you must enclose SQL aliases in braces:"
msgstr ""
"Puede expresar una consulta en SQL, utilizando <literal>createSQLQuery()Connection JDBC "
"directamente. Si elige usar la API de Hibernate, tiene que encerrar los "
"alias de SQL entre llaves:"

#. Tag: programlisting
#: session_api.xml:448
#, no-c-format
msgid ""
"List cats = session.createSQLQuery(\"SELECT {cat.*} FROM CAT {cat} WHERE "
"ROWNUM<10\")\n"
"    .addEntity(\"cat\", Cat.class)\n"
".list();"
msgstr ""

#. Tag: programlisting
#: session_api.xml:450
#, no-c-format
msgid ""
"List cats = session.createSQLQuery(\n"
"    \"SELECT {cat}.ID AS {cat.id}, {cat}.SEX AS {cat.sex}, \" +\n"
"           \"{cat}.MATE AS {cat.mate}, {cat}.SUBCLASS AS {cat.class}, ... \" "
"+\n"
"    \"FROM CAT {cat} WHERE ROWNUM<10\")\n"
"    .addEntity(\"cat\", Cat.class)\n"
".list()"
msgstr ""

#. Tag: para
#: session_api.xml:452
#, fuzzy, no-c-format
msgid ""
"SQL queries can contain named and positional parameters, just like Hibernate "
"queries. More information about native SQL queries in Hibernate can be found "
"in <xref linkend=\"querysql\"/>."
msgstr ""
"Las consultas SQL pueden contener parámetros con nombre y posicionados, al "
"igual que las consultas de Hibernate. Puede encontrar más información sobre "
"las consultas en SQL nativo en Hibernate en el <xref linkend=\"querysql\" /"
">. "

#. Tag: title
#: session_api.xml:459
#, no-c-format
msgid "Modifying persistent objects"
msgstr "Modificación de objetos persistentes"

#. Tag: para
#: session_api.xml:461
#, no-c-format
msgid ""
"<emphasis>Transactional persistent instances (i.e. objects "
"loaded, saved, created or queried by the <literal>Session) can be "
"manipulated by the application, and any changes to persistent state will be "
"persisted when the <literal>Session is flushed, which has a different "
"purpose) to make your modifications persistent. The most straightforward way "
"to update the state of an object is to <literal>load() it and then "
"manipulate it directly while the <literal>Session is open:"
msgstr ""
"Las <emphasis>instancias persistentes transaccionales (por "
"ejemplo, los objetos cargados, creados o consultados por la "
"<literal>Session) pueden ser manipulados por la aplicación y "
"cualquier cambio al estado persistente será persistido cuando se "
"<emphasis>vacie la Session. Esto se discute "
"más adelante en este capítulo. No hay necesidad de llamar a un método en "
"particular (como <literal>update(), que tiene un propósito "
"diferente) para hacer persistentes sus modificaciones. De modo que la forma "
"más directa de actualizar el estado de un objeto es cargarlo con "
"<literal>load() y luego manipularlo directamente, mientras la "
"<literal>Session está abierta:"

#. Tag: programlisting
#: session_api.xml:473
#, no-c-format
msgid ""
"DomesticCat cat = (DomesticCat) sess.load( Cat.class, new Long(69) );\n"
"cat.setName(\"PK\");\n"
"sess.flush();  // changes to cat are automatically detected and persisted"
msgstr ""

#. Tag: para
#: session_api.xml:475
#, no-c-format
msgid ""
"Sometimes this programming model is inefficient, as it requires in the same "
"session both an SQL <literal>SELECT to load an object and an SQL "
"<literal>UPDATE to persist its updated state. Hibernate offers an "
"alternate approach by using detached instances."
msgstr ""
"A veces este modelo de programación es ineficiente pues requiere un "
"<literal>SELECT de SQL para cargar un objeto y un UPDATE or Session."
"merge()</literal> methods:"
msgstr ""
"Hibernate soporta este modelo al proveer re-unión de instancias separadas "
"utilizando los métodos <literal>Session.update() o "
"<literal>Session.merge():"

#. Tag: programlisting
#: session_api.xml:495
#, no-c-format
msgid ""
"// in the first session\n"
"Cat cat = (Cat) firstSession.load(Cat.class, catId);\n"
"Cat potentialMate = new Cat();\n"
"firstSession.save(potentialMate);\n"
"\n"
"// in a higher layer of the application\n"
"cat.setMate(potentialMate);\n"
"\n"
"// later, in a new session\n"
"secondSession.update(cat);  // update cat\n"
"secondSession.update(mate); // update mate"
msgstr ""

#. Tag: para
#: session_api.xml:497
#, no-c-format
msgid ""
"If the <literal>Cat with identifier catId had "
"already been loaded by <literal>secondSession when the application "
"tried to reattach it, an exception would have been thrown."
msgstr ""
"Si el <literal>Cat con identificador catId ya "
"hubiera sido cargado por <literal>secondSession cuando la "
"aplicación intentó volver a unirlo, se habría lanzado una excepción."

#. Tag: para
#: session_api.xml:502
#, no-c-format
msgid ""
"Use <literal>update() if you are certain that the session does not "
"contain an already persistent instance with the same identifier. Use "
"<literal>merge() if you want to merge your modifications at any "
"time without consideration of the state of the session. In other words, "
"<literal>update() is usually the first method you would call in a "
"fresh session, ensuring that the reattachment of your detached instances is "
"the first operation that is executed."
msgstr ""
"Utilice <literal>update() si está seguro de que la sesión no tiene "
"una instancia ya persistente con el mismo identificador. Utilice "
"<literal>merge() si quiere fusionar sus modificaciones en "
"cualquier momento sin consideración del estado de la sesión. En otras "
"palabras, <literal>update() usualmente es el primer método que "
"usted llamaría en una sesión actualizada, asegurando que la re-unión de sus "
"instancias separadas es la primera operación que se ejecuta."

#. Tag: para
#: session_api.xml:510
#, fuzzy, no-c-format
msgid ""
"The application should individually <literal>update() detached "
"instances that are reachable from the given detached instance "
"<emphasis>only if it wants their state to be updated. This can be "
"automated using <emphasis>transitive persistence. See  individualmente "
"las instancias separadas alcanzables desde la instancia separada dada "
"<emphasis>sólo si quiere que su estado se actualice. Esto puede "
"ser automatizado utilizando la <emphasis>persistencia transitiva. "
"Consulte la <xref linkend=\"objectstate-transitive\" /> para obtener mayor "
"información."

#. Tag: para
#: session_api.xml:516
#, no-c-format
msgid ""
"The <literal>lock() method also allows an application to "
"reassociate an object with a new session. However, the detached instance has "
"to be unmodified."
msgstr ""
"El método <literal>lock() también le permite a una aplicación "
"reasociar un objeto con una sesión nueva. Sin embargo, la instancia separada "
"no puede haber sido modificada."

#. Tag: programlisting
#: session_api.xml:520
#, no-c-format
msgid ""
"//just reassociate:\n"
"sess.lock(fritz, LockMode.NONE);\n"
"//do a version check, then reassociate:\n"
"sess.lock(izi, LockMode.READ);\n"
"//do a version check, using SELECT ... FOR UPDATE, then reassociate:\n"
"sess.lock(pk, LockMode.UPGRADE);"
msgstr ""

#. Tag: para
#: session_api.xml:522
#, no-c-format
msgid ""
"Note that <literal>lock() can be used with various "
"<literal>LockModes. See the API documentation and the chapter on "
"transaction handling for more information. Reattachment is not the only "
"usecase for <literal>lock()."
msgstr ""
"Note que <literal>lock() se puede utilizar con varios "
"<literal>LockModes. Consulte la documentación de la API y el "
"capítulo sobre el manejo de transacciones para obtener mayor información. La "
"re-unión no es el único caso de uso para <literal>lock()."

#. Tag: para
#: session_api.xml:527
#, fuzzy, no-c-format
msgid ""
"Other models for long units of work are discussed in <xref linkend="
"\"transactions-optimistic\"/>."
msgstr ""
"Se discuten otros modelos para unidades largas de trabajo en <xref linkend="
"\"transactions-optimistic\" />."

#. Tag: title
#: session_api.xml:532
#, no-c-format
msgid "Automatic state detection"
msgstr "Detección automática de estado"

#. Tag: para
#: session_api.xml:534
#, no-c-format
msgid ""
"Hibernate users have requested a general purpose method that either saves a "
"transient instance by generating a new identifier or updates/reattaches the "
"detached instances associated with its current identifier. The "
"<literal>saveOrUpdate() method implements this functionality."
msgstr ""
"Los usuarios de Hibernate han pedido un método de propósito general que bien "
"guarde una instancia transitoria generando un identificador nuevo, o bien "
"actualice/reúna las instancias separadas asociadas con su identificador "
"actual. El método <literal>saveOrUpdate() implementa esta "
"funcionalidad."

#. Tag: programlisting
#: session_api.xml:540
#, no-c-format
msgid ""
"// in the first session\n"
"Cat cat = (Cat) firstSession.load(Cat.class, catID);\n"
"\n"
"// in a higher tier of the application\n"
"Cat mate = new Cat();\n"
"cat.setMate(mate);\n"
"\n"
"// later, in a new session\n"
"secondSession.saveOrUpdate(cat);   // update existing state (cat has a non-"
"null id)\n"
"secondSession.saveOrUpdate(mate);  // save the new instance (mate has a null "
"id)"
msgstr ""

#. Tag: para
#: session_api.xml:542
#, no-c-format
msgid ""
"The usage and semantics of <literal>saveOrUpdate() seems to be "
"confusing for new users. Firstly, so long as you are not trying to use "
"instances from one session in another new session, you should not need to "
"use <literal>update(), saveOrUpdate(), or "
"<literal>merge(). Some whole applications will never use either of "
"these methods."
msgstr ""
"La utilización y semántica de <literal>saveOrUpdate() parece ser "
"confuso para los usuarios nuevos. Primero, en tanto no esté tratando de "
"utilizar instancias de una sesión en otra sesión nueva, no debe necesitar "
"usar <literal>update(), saveOrUpdate(), o "
"<literal>merge(). Algunas aplicaciones enteras nunca usarán "
"ninguno de estos métodos."

#. Tag: para
#: session_api.xml:549
#, no-c-format
msgid ""
"Usually <literal>update() or saveOrUpdate() are "
"used in the following scenario:"
msgstr ""
"Usualmente <literal>update() o saveOrUpdate() "
"se utilizan en el siguiente escenario:"

#. Tag: para
#: session_api.xml:555
#, no-c-format
msgid "the application loads an object in the first session"
msgstr "la aplicación carga un objeto en la primera sesión"

#. Tag: para
#: session_api.xml:559
#, no-c-format
msgid "the object is passed up to the UI tier"
msgstr "el objeto se pasa a la capa de UI"

#. Tag: para
#: session_api.xml:563
#, no-c-format
msgid "some modifications are made to the object"
msgstr "se realizan algunas modificaciones al objeto"

#. Tag: para
#: session_api.xml:567
#, no-c-format
msgid "the object is passed back down to the business logic tier"
msgstr "el objeto se pasa abajo de regreso a la capa lógica de negocios"

#. Tag: para
#: session_api.xml:571
#, no-c-format
msgid ""
"the application persists these modifications by calling <literal>update() en una segunda sesión"

#. Tag: para
#: session_api.xml:576
#, no-c-format
msgid "<literal>saveOrUpdate() does the following:"
msgstr "<literal>saveOrUpdate() hace lo siguiente:"

#. Tag: para
#: session_api.xml:580
#, no-c-format
msgid "if the object is already persistent in this session, do nothing"
msgstr "si el objeto ya es persistente en esta sesión, no haga nada"

#. Tag: para
#: session_api.xml:585
#, no-c-format
msgid ""
"if another object associated with the session has the same identifier, throw "
"an exception"
msgstr ""
"si otro objeto asociado con la sesión tiene el mismo identificador, lance "
"una excepción"

#. Tag: para
#: session_api.xml:590
#, no-c-format
msgid "if the object has no identifier property, <literal>save() it"
msgstr ""
"si el objeto no tiene ninguna propiedad identificadora, guárdelo llamando a "
"<literal>save()"

#. Tag: para
#: session_api.xml:595
#, no-c-format
msgid ""
"if the object's identifier has the value assigned to a newly instantiated "
"object, <literal>save() it"
msgstr ""
"si el identificador del objeto tiene el valor asignado a un objeto recién "
"instanciado, guárdelo llamando a <literal>save()"

#. Tag: para
#: session_api.xml:600
#, no-c-format
msgid ""
"if the object is versioned by a <literal><version> or "
"<literal><timestamp>, and the version property value is the "
"same value assigned to a newly instantiated object, <literal>save() o "
"<literal><timestamp>, y el valor de la propiedad de versión "
"es el mismo valor asignado a un objeto recién instanciado, guárdelo llamando "
"a <literal>save()"

#. Tag: para
#: session_api.xml:608
#, no-c-format
msgid "otherwise <literal>update() the object"
msgstr ""
"de otra manera actualice el objeto llamando a <literal>update()"

#. Tag: para
#: session_api.xml:612
#, no-c-format
msgid "and <literal>merge() is very different:"
msgstr "y <literal>merge() es muy diferente:"

#. Tag: para
#: session_api.xml:616
#, no-c-format
msgid ""
"if there is a persistent instance with the same identifier currently "
"associated with the session, copy the state of the given object onto the "
"persistent instance"
msgstr ""
"si existe una instancia persistente con el mismo identificador asignado "
"actualmente con la sesión, copie el estado del objeto dado en la instancia "
"persistente"

#. Tag: para
#: session_api.xml:622
#, no-c-format
msgid ""
"if there is no persistent instance currently associated with the session, "
"try to load it from the database, or create a new persistent instance"
msgstr ""
"si no existe ninguna instancia persistente asociada a la sesión actualmente, "
"intente cargarla desde la base de datos, o cree una nueva instancia "
"persistente"

#. Tag: para
#: session_api.xml:628
#, no-c-format
msgid "the persistent instance is returned"
msgstr "la instancia persistente es devuelta"

#. Tag: para
#: session_api.xml:632
#, no-c-format
msgid ""
"the given instance does not become associated with the session, it remains "
"detached"
msgstr "la instancia dada no se asocia a la sesión, permanece separada"

#. Tag: title
#: session_api.xml:639
#, no-c-format
msgid "Deleting persistent objects"
msgstr "Borrado de objetos persistentes"

#. Tag: para
#: session_api.xml:641
#, no-c-format
msgid ""
"<literal>Session.delete() will remove an object's state from the "
"database. Your application, however, can still hold a reference to a deleted "
"object. It is best to think of <literal>delete() as making a "
"persistent instance, transient."
msgstr ""
"<literal>Session.delete() borrará el estado de un objeto de la "
"base de datos. Sin embargo, su aplicación puede tener todavía una referencia "
"a un objeto borrado. Lo mejor es pensar en <literal>delete() al "
"hacer transitoria una instancia persistente."

#. Tag: programlisting
#: session_api.xml:646
#, no-c-format
msgid "sess.delete(cat);"
msgstr ""

#. Tag: para
#: session_api.xml:648
#, no-c-format
msgid ""
"You can delete objects in any order, without risk of foreign key constraint "
"violations. It is still possible to violate a <literal>NOT NULL "
"constraint on a foreign key column by deleting objects in the wrong order, e."
"g. if you delete the parent, but forget to delete the children."
msgstr ""
"Puede borrar objetos en el orden que quiera, sin riesgo de violaciones de "
"restricción de clave foránea. Aún es posible violar una restricción "
"<literal>NOT NULL sobre una columna de clave foránea borrando "
"objetos en un orden erróneo, por ejemplo, si borra el padre, pero olvida "
"borrar los hijos."

#. Tag: title
#: session_api.xml:656
#, no-c-format
msgid "Replicating object between two different datastores"
msgstr "Replicación de objetos entre dos almacenamientos de datos diferentes"

#. Tag: para
#: session_api.xml:658
#, no-c-format
msgid ""
"It is sometimes useful to be able to take a graph of persistent instances "
"and make them persistent in a different datastore, without regenerating "
"identifier values."
msgstr ""
"A veces es útil poder tomar un grafo de la instancias persistentes y "
"hacerlas persistentes en un almacenamiento de datos diferente, sin regenerar "
"los valores identificadores."

#. Tag: programlisting
#: session_api.xml:662
#, no-c-format
msgid ""
"//retrieve a cat from one database\n"
"Session session1 = factory1.openSession();\n"
"Transaction tx1 = session1.beginTransaction();\n"
"Cat cat = session1.get(Cat.class, catId);\n"
"tx1.commit();\n"
"session1.close();\n"
"\n"
"//reconcile with a second database\n"
"Session session2 = factory2.openSession();\n"
"Transaction tx2 = session2.beginTransaction();\n"
"session2.replicate(cat, ReplicationMode.LATEST_VERSION);\n"
"tx2.commit();\n"
"session2.close();"
msgstr ""

#. Tag: para
#: session_api.xml:664
#, no-c-format
msgid ""
"The <literal>ReplicationMode determines how replicate() determina cómo replicate(): ignores the object when there is "
"an existing database row with the same identifier"
msgstr ""
"<literal>ReplicationMode.IGNORE: ignora el objeto cuando existe "
"una fila de la base de datos con el mismo identificador"

#. Tag: para
#: session_api.xml:675
#, no-c-format
msgid ""
"<literal>ReplicationMode.OVERWRITE: overwrites any existing "
"database row with the same identifier"
msgstr ""
"<literal>ReplicationMode.OVERWRITE: sobrescribe cualquier fila de "
"la base de datos existente con el mismo identificador"

#. Tag: para
#: session_api.xml:680
#, no-c-format
msgid ""
"<literal>ReplicationMode.EXCEPTION: throws an exception if there "
"is an existing database row with the same identifier"
msgstr ""
"<literal>ReplicationMode.EXCEPTION: lanza una excepción si existe "
"una fila de la base de datos con el mismo identificador"

#. Tag: para
#: session_api.xml:686
#, no-c-format
msgid ""
"<literal>ReplicationMode.LATEST_VERSION: overwrites the row if its "
"version number is earlier than the version number of the object, or ignore "
"the object otherwise"
msgstr ""
"<literal>ReplicationMode.LATEST_VERSION: sobrescribe la fila si su "
"número de versión es anterior al número de versión del objeto, o de lo "
"contrario ignora el objeto"

#. Tag: para
#: session_api.xml:692
#, no-c-format
msgid ""
"Usecases for this feature include reconciling data entered into different "
"database instances, upgrading system configuration information during "
"product upgrades, rolling back changes made during non-ACID transactions and "
"more."
msgstr ""
"Los casos de uso para esta funcionalidad incluyen reconciliar datos "
"ingresados en instancias diferentes de bases de datos, actualizar "
"información de configuración del sistema durante actualizaciones de "
"producto, deshacer cambios realizados durante transacciones no-ACID y más."

#. Tag: title
#: session_api.xml:699
#, no-c-format
msgid "Flushing the Session"
msgstr "Limpieza (flushing) de la sesión"

#. Tag: para
#: session_api.xml:701
#, no-c-format
msgid ""
"Sometimes the <literal>Session will execute the SQL statements "
"needed to synchronize the JDBC connection's state with the state of objects "
"held in memory. This process, called <emphasis>flush, occurs by "
"default at the following points:"
msgstr ""
"A veces la <literal>Session ejecutará las declaraciones SQL "
"necesarias para sincronizar el estado de la conexión JDBC con el estado de "
"los objetos en la menoria. Este proceso, denominado <emphasis>vaciado (flush)"
"</emphasis>, ocurre por defecto en los siguientes puntos:"

#. Tag: para
#: session_api.xml:709
#, no-c-format
msgid "before some query executions"
msgstr "antes de algunas ejecuciones de consulta"

#. Tag: para
#: session_api.xml:713
#, no-c-format
msgid "from <literal>org.hibernate.Transaction.commit()"
msgstr "desde <literal>org.hibernate.Transaction.commit()"

#. Tag: para
#: session_api.xml:718
#, no-c-format
msgid "from <literal>Session.flush()"
msgstr "desde <literal>Session.flush()"

#. Tag: para
#: session_api.xml:722
#, no-c-format
msgid "The SQL statements are issued in the following order:"
msgstr "Las declaraciones SQL se emiten en el siguiente orden:"

#. Tag: para
#: session_api.xml:726
#, no-c-format
msgid ""
"all entity insertions in the same order the corresponding objects were saved "
"using <literal>Session.save()"
msgstr ""
"todas las inserciones de entidades, en el mismo orden que los objetos "
"correspondientes fueron guardados utilizando <literal>Session.save()"
msgstr ""
"todos los borrados de entidades, en el mismo orden que los objetos "
"correspondientes fueron borrados usando <literal>Session.delete() "

#. Tag: para
#: session_api.xml:752
#, no-c-format
msgid ""
"An exception is that objects using <literal>native ID generation "
"are inserted when they are saved."
msgstr ""
"Una excepción es que los objetos que utilizan generación de ID "
"<literal>native se insertan cuando se guardan."

#. Tag: para
#: session_api.xml:755
#, no-c-format
msgid ""
"Except when you explicitly <literal>flush(), there are absolutely "
"no guarantees about <emphasis>when the Session "
"executes the JDBC calls, only the <emphasis>order in which they "
"are executed. However, Hibernate does guarantee that the <literal>Query.list"
"(..)</literal> will never return stale or incorrect data."
msgstr ""
"Excepto cuando llama explícitamente a <literal>flush(), no hay en "
"absoluto garantías sobre <emphasis>cuándo la Sessionorden nunca devolverán datos "
"desactualizados o incorrectos."

#. Tag: para
#: session_api.xml:762
#, fuzzy, no-c-format
msgid ""
"It is possible to change the default behavior so that flush occurs less "
"frequently. The <literal>FlushMode class defines three different "
"modes: only flush at commit time when the Hibernate <literal>Transaction is called explicitly. The last "
"mode is useful for long running units of work, where a <literal>Session define "
"tres modos diferentes: sólo en tiempo de guardar los cambios cuando la API "
"de <literal>Transaction de Hibernate se utiliza, vaciado "
"automático utilizando la rutina explicada, o nunca vaciar a menos de que se "
"llame a <literal>flush() explícitamente. El último modo es útil "
"para unidades de trabajo largas, donde se mantiene abierta una "
"<literal>Session y es desconectada por largo tiempo (consulte la "
"<xref linkend=\"transactions-optimistic-longsession\"/>)."

#. Tag: programlisting
#: session_api.xml:772
#, no-c-format
msgid ""
"sess = sf.openSession();\n"
"Transaction tx = sess.beginTransaction();\n"
"sess.setFlushMode(FlushMode.COMMIT); // allow queries to return stale state\n"
"\n"
"Cat izi = (Cat) sess.load(Cat.class, id);\n"
"izi.setName(iznizi);\n"
"\n"
"// might return stale data\n"
"sess.find(\"from Cat as cat left outer join cat.kittens kitten\");\n"
"\n"
"// change to izi is not flushed!\n"
"...\n"
"tx.commit(); // flush occurs\n"
"sess.close();"
msgstr ""

#. Tag: para
#: session_api.xml:774
#, fuzzy, no-c-format
msgid ""
"During flush, an exception might occur (e.g. if a DML operation violates a "
"constraint). Since handling exceptions involves some understanding of "
"Hibernate's transactional behavior, we discuss it in <xref linkend="
"\"transactions\"/>."
msgstr ""
"Durante el vaciado se puede presentar una excepción (por ejemplo, si una "
"operación DML viola una restricción). Ya que el manejo de excepciones "
"implica algo de comprensión del comportamiento transaccional de Hibernate, "
"lo discutimos en <xref linkend=\"transactions\" />. "

#. Tag: title
#: session_api.xml:781
#, no-c-format
msgid "Transitive persistence"
msgstr "Persistencia transitiva"

#. Tag: para
#: session_api.xml:783
#, no-c-format
msgid ""
"It is quite cumbersome to save, delete, or reattach individual objects, "
"especially if you deal with a graph of associated objects. A common case is "
"a parent/child relationship. Consider the following example:"
msgstr ""
"Es absolutamente incómodo guardar, borrar, o reunir objetos individuales, "
"especialmente si trata con un grafo de objetos asociados. Un caso común es "
"una relación padre/hijo. Considere el siguiente ejemplo:"

#. Tag: para
#: session_api.xml:788
#, no-c-format
msgid ""
"If the children in a parent/child relationship would be value typed (e.g. a "
"collection of addresses or strings), their life cycle would depend on the "
"parent and no further action would be required for convenient \"cascading\" "
"of state changes. When the parent is saved, the value-typed child objects "
"are saved and when the parent is deleted, the children will be deleted, etc. "
"This works for operations such as the removal of a child from the "
"collection. Since value-typed objects cannot have shared references, "
"Hibernate will detect this and delete the child from the database."
msgstr ""
"Si los hijos en una relación padre/hijo pudieran ser tipificados en valor "
"(por ejemplo, una colección de direcciones o cadenas), sus ciclos de vida "
"dependerían del padre y no se requeriría ninguna otra acción para el "
"tratamiento apropiado en \"cascada\" de los cambios de estado. Cuando se "
"guarda el padre, los objetos hijo tipificados en valor también se guardan, "
"cuando se borra el padre, se borran los hijos, etc. Esto funciona incluso "
"para operaciones tales como el retiro de un hijo de la colección. Hibernate "
"detectará esto y ya que los objetos tipificados en valor no pueden tener "
"referencias compartidas entonces borrará el hijo de la base de datos."

#. Tag: para
#: session_api.xml:798
#, no-c-format
msgid ""
"Now consider the same scenario with parent and child objects being entities, "
"not value-types (e.g. categories and items, or parent and child cats). "
"Entities have their own life cycle and support shared references. Removing "
"an entity from the collection does not mean it can be deleted), and there is "
"by default no cascading of state from one entity to any other associated "
"entities. Hibernate does not implement <emphasis>persistence by "
"reachability</emphasis> by default."
msgstr ""
"Ahora considere el mismo escenario con los objetos padre e hijos siendo "
"entidades, no tipos de valor (por ejemplo, categorías e ítems, o gatos "
"padres e hijos). Las entidades tienen su propio ciclo de vida y soportan "
"referencias compartidas. El eliminar una entidad de una colección no "
"significa que se pueda borrar, y no hay por defecto ningún tratamiento en "
"\"cascada\" del estado de una entidad a otras entidades asociadas. Hibernate "
"no implementa por defecto la <emphasis>persistencia por alcance."

#. Tag: para
#: session_api.xml:806
#, no-c-format
msgid ""
"For each basic operation of the Hibernate session - including "
"<literal>persist(), merge(), saveOrUpdate(), delete(), lock(), refresh(), "
"evict(), replicate()</literal> - there is a corresponding cascade style. "
"Respectively, the cascade styles are named <literal>create, merge, save-"
"update, delete, lock, refresh, evict, replicate</literal>. If you want an "
"operation to be cascaded along an association, you must indicate that in the "
"mapping document. For example:"
msgstr ""
"Para cada operación básica de la sesión de Hibernate - incluyendo "
"<literal>persist(), merge(), saveOrUpdate(), delete(), lock(), refresh(), "
"evict(), replicate()</literal> - existe un estilo de cascada "
"correspondiente. Respectivamente, los estilos de cascada se llaman "
"<literal>create, merge, save-update, delete, lock, refresh, evict, "
"replicate</literal>. Si quiere que una operación sea tratada en cascada a lo "
"largo de una asociación, debe indicar eso en el documento de mapeo. Por "
"ejemplo:"

#. Tag: programlisting
#: session_api.xml:814
#, no-c-format
msgid "<one-to-one name=\"person\" cascade=\"persist\"/>"
msgstr ""

#. Tag: para
#: session_api.xml:816
#, no-c-format
msgid "Cascade styles my be combined:"
msgstr "Los estilos de cascada pueden combinarse:"

#. Tag: programlisting
#: session_api.xml:818
#, no-c-format
msgid "<one-to-one name=\"person\" cascade=\"persist,delete,lock\"/>"
msgstr ""

#. Tag: para
#: session_api.xml:820
#, no-c-format
msgid ""
"You can even use <literal>cascade=\"all\" to specify that "
"<emphasis>all operations should be cascaded along the "
"association. The default <literal>cascade=\"none\" specifies that "
"no operations are to be cascaded."
msgstr ""
"Incluso puede utilizar <literal>cascade=\"all\" para especificar "
"que <emphasis>todas las operaciones deben ser tratadas en cascada "
"a lo largo de la asociación. La <literal>cascade=\"none\" "
"predeterminada especifica que ninguna operación se tratará en cascada. "

#. Tag: para
#: session_api.xml:825
#, no-c-format
msgid ""
"In case you are using annotatons you probably have noticed the "
"<literal>cascade attribute taking an array of "
"<classname>CascadeType as a value. The cascade concept in JPA is "
"very is similar to the transitive persistence and cascading of operations as "
"described above, but with slightly different semantics and cascading types:"
msgstr ""

#. Tag: para
#: session_api.xml:834
#, no-c-format
msgid ""
"<literal>CascadeType.PERSIST: cascades the persist (create) "
"operation to associated entities persist() is called or if the entity is "
"managed"
msgstr ""

#. Tag: para
#: session_api.xml:840
#, no-c-format
msgid ""
"<literal>CascadeType.MERGE: cascades the merge operation to "
"associated entities if merge() is called or if the entity is managed"
msgstr ""

#. Tag: para
#: session_api.xml:846
#, no-c-format
msgid ""
"<literal>CascadeType.REMOVE: cascades the remove operation to "
"associated entities if delete() is called"
msgstr ""

#. Tag: para
#: session_api.xml:851
#, no-c-format
msgid ""
"<literal>CascadeType.REFRESH: cascades the refresh operation to "
"associated entities if refresh() is called"
msgstr ""

#. Tag: para
#: session_api.xml:856
#, no-c-format
msgid ""
"<literal>CascadeType.DETACH: cascades the detach operation to "
"associated entities if detach() is called"
msgstr ""

#. Tag: para
#: session_api.xml:861
#, fuzzy, no-c-format
msgid "<literal>CascadeType.ALL: all of the above"
msgstr "<literal>saveOrUpdate() hace lo siguiente:"

#. Tag: para
#: session_api.xml:866
#, no-c-format
msgid ""
"CascadeType.ALL also covers Hibernate specific operations like save-update, "
"lock etc..."
msgstr ""

#. Tag: para
#: session_api.xml:870
#, no-c-format
msgid ""
"A special cascade style, <literal>delete-orphan, applies only to "
"one-to-many associations, and indicates that the <literal>delete() "
"operation should be applied to any child object that is removed from the "
"association. Using annotations there is no <literal>CascadeType.DELETE-"
"ORPHAN</literal> equivalent. Instead you can use the attribute "
"<literal>orphanRemoval as seen in  collection or an associated entity is "
"dereferenced from a <classname>@OneToOne association, this "
"associated entity can be marked for deletion if <literal>orphanRemoval with orphanRemoval"
msgstr ""

#. Tag: programlisting
#: session_api.xml:886
#, no-c-format
msgid ""
"@Entity \n"
"public class Customer {\n"
"   private Set<Order> orders;\n"
"\n"
"   @OneToMany(cascade=CascadeType.ALL, orphanRemoval=true) \n"
"   public Set<Order> getOrders() { return orders; }\n"
"\n"
"   public void setOrders(Set<Order> orders) { this.orders = orders; }\n"
"\n"
"   [...]\n"
"}\n"
"\n"
"@Entity \n"
"public class Order { ... }\n"
"\n"
"Customer customer = em.find(Customer.class, 1l);\n"
"Order order = em.find(Order.class, 1l);\n"
"customer.getOrders().remove(order); //order will be deleted by cascade"
msgstr ""

#. Tag: para
#: session_api.xml:889
#, no-c-format
msgid "Recommendations:"
msgstr "Recomendaciones:"

#. Tag: para
#: session_api.xml:893
#, fuzzy, no-c-format
msgid ""
"It does not usually make sense to enable cascade on a many-to-one or many-to-"
"many association. In fact the <literal>@ManyToOne and "
"<literal>@ManyToMany don't even offer a orphanRemoval o <many-to-"
"many></literal>. El tratamiento en cascada es frecuentemente útil para "
"las asociaciones <literal><one-to-one> y <one-to-"
"many></literal>."

#. Tag: para
#: session_api.xml:901
#, fuzzy, no-c-format
msgid ""
"If the child object's lifespan is bounded by the lifespan of the parent "
"object, make it a <emphasis>life cycle object by specifying "
"<literal>cascade=\"all,delete-orphan\"(@OneToMany"
"(cascade=CascadeType.ALL, orphanRemoval=true)</literal>)."
msgstr ""
"Si el periodo de vida de los objetos hijos está ligado al periodo de vida "
"del objeto padre, hágalo un <emphasis>objeto de ciclo de vida "
"especificando <literal>cascade=\"all,delete-orphan\". "

#. Tag: para
#: session_api.xml:909
#, no-c-format
msgid ""
"Otherwise, you might not need cascade at all. But if you think that you will "
"often be working with the parent and children together in the same "
"transaction, and you want to save yourself some typing, consider using "
"<literal>cascade=\"persist,merge,save-update\"."
msgstr ""
"En otro caso, puede que usted no necesite tratamiento en cascada en "
"absoluto. Pero si piensa que va a estar trabajando frecuentemente con padre "
"e hijos juntos en la misma transacción, y quiere ahorrarse algo de escritura "
"en computador, considere el utilizar <literal>cascade=\"persist,merge,save-"
"update\"</literal>."

#. Tag: para
#: session_api.xml:917
#, no-c-format
msgid ""
"Mapping an association (either a single valued association, or a collection) "
"with <literal>cascade=\"all\" marks the association as a "
"<emphasis>parent/child style relationship where save/update/"
"delete of the parent results in save/update/delete of the child or children."
msgstr ""
"Mapear una asociación (ya sea una asociación monovaluada, o una colección) "
"con <literal>cascade=\"all\" marca la asociación como una relación "
"del estilo <emphasis>padre/hijo en donde guardar/actualizar/"
"borrar (save/update/delete) el padre causa el guardar/actualizar/borrar del "
"hijo o hijos."

#. Tag: para
#: session_api.xml:923
#, fuzzy, no-c-format
msgid ""
"Furthermore, a mere reference to a child from a persistent parent will "
"result in save/update of the child. This metaphor is incomplete, however. A "
"child which becomes unreferenced by its parent is <emphasis>not "
"automatically deleted, except in the case of a one-to-many association "
"mapped with <literal>cascade=\"delete-orphan\". The precise "
"semantics of cascading operations for a parent/child relationship are as "
"follows:"
msgstr ""
"Además, una mera referencia a un hijo desde un padre persistente hará que se "
"guarde/actualice el hijo. Sin embargo, esta metáfora se encuentra "
"incompleta. Un hijo que deje de ser referenciado por su padre <emphasis>no mapeada con cascade=\"delete-"
"orphan\"</literal>. La semántica precisa de las operaciones en cascada para "
"una relación padre/hijo es la siguiente:"

#. Tag: para
#: session_api.xml:934
#, no-c-format
msgid ""
"If a parent is passed to <literal>persist(), all children are "
"passed to <literal>persist()"
msgstr ""
"Si un padre pasa a <literal>persist(), se pasan todos los hijos a "
"<literal>persist()"

#. Tag: para
#: session_api.xml:939
#, no-c-format
msgid ""
"If a parent is passed to <literal>merge(), all children are passed "
"to <literal>merge()"
msgstr ""
"Si un padre pasa a <literal>merge(), se pasan todos los hijos a "
"<literal>merge()"

#. Tag: para
#: session_api.xml:944
#, no-c-format
msgid ""
"If a parent is passed to <literal>save(), update()saveOrUpdate(), all children are passed to "
"<literal>saveOrUpdate()"
msgstr ""
"Si se pasa un padre a <literal>save(), update() "
"o <literal>saveOrUpdate(), todos los hijos pasan a "
"<literal>saveOrUpdate()"

#. Tag: para
#: session_api.xml:950
#, no-c-format
msgid ""
"If a transient or detached child becomes referenced by a persistent parent, "
"it is passed to <literal>saveOrUpdate()"
msgstr ""
"Si un hijo transitorio o separado se vuelve referenciado por un padre "
"persistente, le es pasado a <literal>saveOrUpdate()"

#. Tag: para
#: session_api.xml:956
#, no-c-format
msgid ""
"If a parent is deleted, all children are passed to <literal>delete()"

#. Tag: para
#: session_api.xml:961
#, no-c-format
msgid ""
"If a child is dereferenced by a persistent parent, <emphasis>nothing special "
"happens</emphasis> - the application should explicitly delete the child if "
"necessary - unless <literal>cascade=\"delete-orphan\", in which "
"case the \"orphaned\" child is deleted."
msgstr ""
"Si un hijo deja de ser referenciado por un padre persistente, <emphasis>no "
"ocurre nada especial</emphasis> - la aplicación debe borrar explícitamente "
"el hijo de ser necesario - a menos que <literal>cascade=\"delete-orphan\" or at flush time. All "
"operations, if enabled, are cascaded to associated entities reachable when "
"the operation is executed. However, <literal>save-update and "
"<literal>delete-orphan are transitive for all associated entities "
"reachable during flush of the <literal>Session."
msgstr ""
"Finalmente, note que las operaciones en cascadas se pueden aplicar a un "
"grafo de objeto en <emphasis>tiempo de llamada o en "
"<emphasis>tiempo de vaciado. Todas las operaciones, si se "
"encuentran activadas se tratan en cascadas en entidades asociadas "
"alcanzables cuando se ejecuta la operación. Sin embargo, <literal>save-"
"upate</literal> y delete-orphan son transitivos para "
"todas las entidades asociadas alcanzables durante el vaciado de la "
"<literal>Session."

#. Tag: title
#: session_api.xml:979
#, no-c-format
msgid "Using metadata"
msgstr "Utilización de metadatos"

#. Tag: para
#: session_api.xml:981
#, no-c-format
msgid ""
"Hibernate requires a rich meta-level model of all entity and value types. "
"This model can be useful to the application itself. For example, the "
"application might use Hibernate's metadata to implement a \"smart\" deep-"
"copy algorithm that understands which objects should be copied (eg. mutable "
"value types) and which objects that should not (e.g. immutable value types "
"and, possibly, associated entities)."
msgstr ""
"Hibernate requiere de un modelo de meta-nivel muy rico de todas las "
"entidades y tipos de valor. Este modelo puede ser útil para la aplicación "
"misma. Por ejemplo, la aplicación podría utilizar los metadatos de Hibernate "
"para implementar un algoritmo \"inteligente\" de copia en profundidad que "
"entienda qué objetos deben ser copiados (por ejemplo, tipos de valor "
"mutables) y cuáles no (por ejemplo, tipos de valor inmutables y posiblemente "
"las entidades asociadas)."

#. Tag: para
#: session_api.xml:988
#, no-c-format
msgid ""
"Hibernate exposes metadata via the <literal>ClassMetadata and "
"<literal>CollectionMetadata interfaces and the Type."
msgstr ""
"Hibernate expone los metadatos por medio de las interfaces "
"<literal>ClassMetadata y CollectionMetadata y "
"la jerarquía <literal>Type. Las instancias de las interfaces de "
"metadatos se pueden obtener de la <literal>SessionFactory."

#. Tag: programlisting
#: session_api.xml:993
#, no-c-format
msgid ""
"Cat fritz = ......;\n"
"ClassMetadata catMeta = sessionfactory.getClassMetadata(Cat.class);\n"
"\n"
"Object[] propertyValues = catMeta.getPropertyValues(fritz);\n"
"String[] propertyNames = catMeta.getPropertyNames();\n"
"Type[] propertyTypes = catMeta.getPropertyTypes();\n"
"\n"
"// get a Map of all properties which are not collections or associations\n"
"Map namedValues = new HashMap();\n"
"for ( int i=0; i<propertyNames.length; i++ ) {\n"
"    if ( !propertyTypes[i].isEntityType() && !propertyTypes[i]."
"isCollectionType() ) {\n"
"        namedValues.put( propertyNames[i], propertyValues[i] );\n"
"    }\n"
"}"
msgstr ""

#, fuzzy
#~ msgid ""
#~ "Hibernate does not offer its own API for direct execution of "
#~ "<literal>UPDATE or DELETE statements. "
#~ "Hibernate is a <emphasis>state management service, you do not "
#~ "have to think in <emphasis>statements to use it. JDBC is a "
#~ "perfect API for executing SQL statements, you can get a JDBC "
#~ "<literal>Connection at any time by calling session."
#~ "connection()</literal>. Furthermore, the notion of mass operations "
#~ "conflicts with object/relational mapping for online transaction "
#~ "processing-oriented applications. Future versions of Hibernate can, "
#~ "however, provide special mass operation functions. See <xref linkend="
#~ "\"batch\"/> for some possible batch operation tricks."
#~ msgstr ""
#~ "Hibernate no ofrece su propia API para ejecución directa de declaraciones "
#~ "<literal>UPDATE o DELETE. Hibernate es un "
#~ "servicio de <emphasis>administración de estado, no tiene que "
#~ "pensar en <emphasis>declaraciones para poder utilizarlo. JDBC "
#~ "es una API perfecta para ejecutar declaraciones SQL; puede obtener una "
#~ "<literal>Connection JDBC en cualquier momento llamando a "
#~ "<literal>session.connection(). Además, la noción de operaciones "
#~ "masivas entra en conflicto con el mapeo objeto/relacional en aplicaciones "
#~ "en línea orientadas al procesamiento de transacciones. Sin embargo, las "
#~ "versiones futuras de Hibernate podrán proporcionar funciones de operación "
#~ "masiva especiales. Consulte <xref linkend=\"batch\"/> para obtener "
#~ "algunos trucos posibles para la operación en lote. "

#~ msgid ""
#~ "A special cascade style, <literal>delete-orphan, applies only "
#~ "to one-to-many associations, and indicates that the <literal>delete(), se "
#~ "aplica sólamente a asociaciones uno-a-muchos, e indica que la operación "
#~ "<literal>delete() debe aplicarse a cualquier objeto hijo que se "
#~ "elimine de la asociación."

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate session_api.po source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.