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

Hibernate example source code file (query_sql.po)

This example Hibernate source code file (query_sql.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

as, cats, from, hibernate, hibernate, name, select, sql, sql, tag, tag, the, the, where

The Hibernate query_sql.po source code

# translation of query_sql.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: query_sql\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-07-20 21:02+0000\n"
"PO-Revision-Date: 2010-03-17 12:28+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
#: query_sql.xml:31
#, no-c-format
msgid "Native SQL"
msgstr "SQL Nativo"

#. Tag: para
#: query_sql.xml:33
#, no-c-format
msgid ""
"You can also express queries in the native SQL dialect of your database. "
"This is useful if you want to utilize database-specific features such as "
"query hints or the <literal>CONNECT keyword in Oracle. It also "
"provides a clean migration path from a direct SQL/JDBC based application to "
"Hibernate."
msgstr ""
"También puede expresar sus consultas en el dialecto SQL nativo de su base de "
"datos. Esto es útil si quiere utilizar las características especificas de la "
"base de datos tales como hints de consulta o la palabra clave "
"<literal>CONNECT en Oracle. También proporciona una ruta de "
"migración limpia desde una aplicación basada en SQL/JDBC a Hibernate."

#. Tag: para
#: query_sql.xml:39
#, no-c-format
msgid ""
"Hibernate3 allows you to specify handwritten SQL, including stored "
"procedures, for all create, update, delete, and load operations."
msgstr ""
"Hibernate3 le permite especificar SQL escrito a mano, incluyendo "
"procedimientos almacenados para todas las operaciones create, update, delete "
"y load."

#. Tag: title
#: query_sql.xml:43
#, no-c-format
msgid "Using a <literal>SQLQuery"
msgstr "Uso de una <literal>SQLQuery"

#. Tag: para
#: query_sql.xml:45
#, no-c-format
msgid ""
"Execution of native SQL queries is controlled via the <literal>SQLQuerySession."
"createSQLQuery()</literal>. The following sections describe how to use this "
"API for querying."
msgstr ""
"La ejecución de consultas SQL nativas se controla por medio de la interfaz "
"<literal>SQLQuery, la cual se obtiene llamando a Session."
"createSQLQuery()</literal>. Las siguientes secciones describen cómo utilizar "
"esta API para consultas."

#. Tag: title
#: query_sql.xml:51
#, no-c-format
msgid "Scalar queries"
msgstr "Consultas escalares"

#. Tag: para
#: query_sql.xml:53
#, no-c-format
msgid "The most basic SQL query is to get a list of scalars (values)."
msgstr ""
"La consulta SQL más básica es para obtener a una lista de escalares "
"(valores)."

#. Tag: programlisting
#: query_sql.xml:56
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT * FROM CATS\").list();\n"
"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").list();"
msgstr ""

#. Tag: para
#: query_sql.xml:58
#, no-c-format
msgid ""
"These will return a List of Object arrays (Object[]) with scalar values for "
"each column in the CATS table. Hibernate will use ResultSetMetadata to "
"deduce the actual order and types of the returned scalar values."
msgstr ""
"Estas retornarán una lista de objetos arrays (Object[]) con valores "
"escalares para cada columna en la tabla CATS. Hibernate utilizará "
"ResultSetMetadata para deducir el orden real y los tipos de los valores "
"escalares retornados."

#. Tag: para
#: query_sql.xml:63
#, no-c-format
msgid ""
"To avoid the overhead of using <literal>ResultSetMetadata, or "
"simply to be more explicit in what is returned, one can use "
"<literal>addScalar():"
msgstr ""
"Para evitar los gastos generales de la utilización de "
"<literal>ResultSetMetadata o simplemente para ser más explícito en "
"lo que se devuelve se puede utilizar <literal>addScalar():"

#. Tag: programlisting
#: query_sql.xml:67
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT * FROM CATS\")\n"
" .addScalar(\"ID\", Hibernate.LONG)\n"
" .addScalar(\"NAME\", Hibernate.STRING)\n"
" .addScalar(\"BIRTHDATE\", Hibernate.DATE)"
msgstr ""

#. Tag: para
#: query_sql.xml:69 query_sql.xml:116 query_sql.xml:197 query_sql.xml:349
#, no-c-format
msgid "This query specified:"
msgstr "Se especifica esta consulta:"

#. Tag: para
#: query_sql.xml:73 query_sql.xml:120 query_sql.xml:353
#, no-c-format
msgid "the SQL query string"
msgstr "la cadena de consulta SQL"

#. Tag: para
#: query_sql.xml:77
#, no-c-format
msgid "the columns and types to return"
msgstr "las columnas y tipos que se devuelven"

#. Tag: para
#: query_sql.xml:81
#, no-c-format
msgid ""
"This will return Object arrays, but now it will not use "
"<literal>ResultSetMetadata but will instead explicitly get the ID, "
"NAME and BIRTHDATE column as respectively a Long, String and a Short from "
"the underlying resultset. This also means that only these three columns will "
"be returned, even though the query is using <literal>* and could "
"return more than the three listed columns."
msgstr ""
"Esto retornará objetos arrays, pero no utilizará <literal>ResultSetMetdata y pueda devolver más de las tres columnas enumeradas."

#. Tag: para
#: query_sql.xml:89
#, no-c-format
msgid ""
"It is possible to leave out the type information for all or some of the "
"scalars."
msgstr ""
"Es posible dejar afuera la información de tipo para todos o algunos de los "
"escalares."

#. Tag: programlisting
#: query_sql.xml:92
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT * FROM CATS\")\n"
" .addScalar(\"ID\", Hibernate.LONG)\n"
" .addScalar(\"NAME\")\n"
" .addScalar(\"BIRTHDATE\")"
msgstr ""

#. Tag: para
#: query_sql.xml:94
#, no-c-format
msgid ""
"This is essentially the same query as before, but now "
"<literal>ResultSetMetaData is used to determine the type of NAME "
"and BIRTHDATE, where as the type of ID is explicitly specified."
msgstr ""
"Esto es esencialmente la misma consulta que antes, pero ahora se utiliza "
"<literal>ResultSetMetaData para determinar el tipo de NOMBRE y "
"FECHA DE NACIMIENTO, mientras que el tipo de IDENTIFICACION se especifica "
"explícitamente."

#. Tag: para
#: query_sql.xml:99
#, no-c-format
msgid ""
"How the java.sql.Types returned from ResultSetMetaData is mapped to "
"Hibernate types is controlled by the Dialect. If a specific type is not "
"mapped, or does not result in the expected type, it is possible to customize "
"it via calls to <literal>registerHibernateType in the Dialect."
msgstr ""
"El dialecto controla la manera en que los java.sql.Types retornados de "
"ResultSetMetaData se mapean a los tipos de Hibernate. Si un tipo en especial "
"no se encuentra mapeado o no resulta en el tipo esperado es posible "
"personalizarlo por medio de llamadas a <literal>registerHibernateType."

#. Tag: programlisting
#: query_sql.xml:114
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT * FROM CATS\").addEntity(Cat.class);\n"
"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE FROM CATS\").addEntity(Cat."
"class);"
msgstr ""

#. Tag: para
#: query_sql.xml:124
#, no-c-format
msgid "the entity returned by the query"
msgstr "la entidad devuelta por la consulta"

#. Tag: para
#: query_sql.xml:128
#, no-c-format
msgid ""
"Assuming that Cat is mapped as a class with the columns ID, NAME and "
"BIRTHDATE the above queries will both return a List where each element is a "
"Cat entity."
msgstr ""
"Asumiendo que Cat es mapeado como una clase con las columnas IDENTIFICACION, "
"NOMBRE y FECHA DE NACIMIENTO las consultas anteriores devolverán una Lista "
"en donde cada elemento es una entidad Cat."

#. Tag: para
#: query_sql.xml:132
#, no-c-format
msgid ""
"If the entity is mapped with a <literal>many-to-one to another "
"entity it is required to also return this when performing the native query, "
"otherwise a database specific \"column not found\" error will occur. The "
"additional columns will automatically be returned when using the * notation, "
"but we prefer to be explicit as in the following example for a <literal>many-"
"to-one</literal> to a Dog:"
msgstr ""
"Si la entidad es mapeada con una <literal>many-to-one a otra "
"entidad tambien se necesita que devuelva esto cuando realice una consulta "
"nativa, de otra manera, aparecerá un error \"no se encontró la columna\" "
"específico a la base de datos. Se devolverán automáticamente las columnas "
"adicionales cuando se utiliza la anotación *, pero preferimos ser tan "
"explícitos así como lo muestra el siguiente ejemplo para una <literal>many-"
"to-one</literal> a un Dog:"

#. Tag: programlisting
#: query_sql.xml:140
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, DOG_ID FROM CATS\")."
"addEntity(Cat.class);"
msgstr ""

#. Tag: para
#: query_sql.xml:142
#, no-c-format
msgid "This will allow cat.getDog() to function properly."
msgstr "Esto permitirá que cat.getDog() funcione apropiadamente."

#. Tag: title
#: query_sql.xml:146
#, no-c-format
msgid "Handling associations and collections"
msgstr "Manejo de asociaciones y colecciones"

#. Tag: para
#: query_sql.xml:148
#, no-c-format
msgid ""
"It is possible to eagerly join in the <literal>Dog to avoid the "
"possible extra roundtrip for initializing the proxy. This is done via the "
"<literal>addJoin() method, which allows you to join in an "
"association or collection."
msgstr ""
"Es posible unir de manera temprana en el <literal>Dog para evitar "
"el posible viaje de ida y vuelta para iniciar el proxy. Esto se hace por "
"medio del método <literal>addJoin(), el cual le permite unirse en "
"una asociación o colección."

#. Tag: programlisting
#: query_sql.xml:153
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT c.ID, NAME, BIRTHDATE, DOG_ID, D_ID, D_NAME "
"FROM CATS c, DOGS d WHERE c.DOG_ID = d.D_ID\")\n"
" .addEntity(\"cat\", Cat.class)\n"
" .addJoin(\"cat.dog\");"
msgstr ""

#. Tag: para
#: query_sql.xml:155
#, no-c-format
msgid ""
"In this example, the returned <literal>Cat's will have their "
"<literal>dog property fully initialized without any extra "
"roundtrip to the database. Notice that you added an alias name (\"cat\") to "
"be able to specify the target property path of the join. It is possible to "
"do the same eager joining for collections, e.g. if the <literal>CatDog instead."
msgstr ""
"En este ejemplo los <literal>Cats retornados tendrán su propiedad "
"<literal>dog completamente iniciada sin ningún viaje extra de ida "
"y vuelta a la base de datos. Observe que agregó un nombre alias (\"cat\") "
"para poder especificar la ruta de la propiedad de destino de la unión. Es "
"posible hacer la misma unión temprana para colecciones, por ejemplo, si el "
"<literal>Cat tuviese en lugar un Dog uno-a-"
"muchos."

#. Tag: programlisting
#: query_sql.xml:163
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT ID, NAME, BIRTHDATE, D_ID, D_NAME, CAT_ID FROM "
"CATS c, DOGS d WHERE c.ID = d.CAT_ID\")\n"
" .addEntity(\"cat\", Cat.class)\n"
" .addJoin(\"cat.dogs\");"
msgstr ""

#. Tag: para
#: query_sql.xml:165
#, no-c-format
msgid ""
"At this stage you are reaching the limits of what is possible with native "
"queries, without starting to enhance the sql queries to make them usable in "
"Hibernate. Problems can arise when returning multiple entities of the same "
"type or when the default alias/column names are not enough."
msgstr ""
"En este punto estamos alcanzando los límites de lo que es posible con las "
"consultas nativas sin empezar a mejorar las consultas sql para hacerlas "
"utilizables en Hibernate. Los problemas empiezan a surgir cuando las "
"entidades múltiples retornadas son del mismo tipo o cuando no son "
"suficientes los nombres de las columnas/alias predeterminados."

#. Tag: title
#: query_sql.xml:173
#, no-c-format
msgid "Returning multiple entities"
msgstr "Devolución de entidades múltiples"

#. Tag: para
#: query_sql.xml:175
#, no-c-format
msgid ""
"Until now, the result set column names are assumed to be the same as the "
"column names specified in the mapping document. This can be problematic for "
"SQL queries that join multiple tables, since the same column names can "
"appear in more than one table."
msgstr ""
"Hasta ahora se ha asumido que los nombres de las columnas del grupo de "
"resultados son las mismas que los nombres de columnas especificados en el "
"documento de mapeo. Esto puede llegar a ser problemático para las consultas "
"SQL que unen múltiples tablas ya que los mismos nombres de columnas pueden "
"aparecer en más de una tabla."

#. Tag: para
#: query_sql.xml:180
#, no-c-format
msgid ""
"Column alias injection is needed in the following query (which most likely "
"will fail):"
msgstr ""
"Se necesita una inyección de alias en las columnas en la siguiente consulta "
"(que con mucha probabilidad fallará):"

#. Tag: programlisting
#: query_sql.xml:183
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT c.*, m.*  FROM CATS c, CATS m WHERE c.MOTHER_ID "
"= c.ID\")\n"
" .addEntity(\"cat\", Cat.class)\n"
" .addEntity(\"mother\", Cat.class)"
msgstr ""

#. Tag: para
#: query_sql.xml:185
#, no-c-format
msgid ""
"The query was intended to return two Cat instances per row: a cat and its "
"mother. The query will, however, fail because there is a conflict of names; "
"the instances are mapped to the same column names. Also, on some databases "
"the returned column aliases will most likely be on the form \"c.ID\", \"c."
"NAME\", etc. which are not equal to the columns specified in the mappings "
"(\"ID\" and \"NAME\")."
msgstr ""
"La intención de esta consulta es retornar dos instancias Cat por fila: un "
"gato y su mamá. Sin embargo, esto fallará debido a que hay un conflicto de "
"nombres;las instancias se encuentran mapeadas a los mismos nombres de "
"columna. También en algunas bases de datos los alias de las columnas "
"retornadas serán con mucha probabilidad de la forma \"c.IDENTIFICACION\", "
"\"c.NOMBRE\", etc, los cuales no son iguales a las columnas especificadas en "
"los mapeos (\"IDENTIFICACION\" y \"NOMBRE\")."

#. Tag: para
#: query_sql.xml:192
#, no-c-format
msgid "The following form is not vulnerable to column name duplication:"
msgstr ""
"La siguiente forma no es vulnerable a la duplicación de nombres de columnas:"

#. Tag: programlisting
#: query_sql.xml:195
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT {cat.*}, {mother.*}  FROM CATS c, CATS m WHERE "
"c.MOTHER_ID = c.ID\")\n"
" .addEntity(\"cat\", Cat.class)\n"
" .addEntity(\"mother\", Cat.class)"
msgstr ""

#. Tag: para
#: query_sql.xml:201
#, no-c-format
msgid ""
"the SQL query string, with placeholders for Hibernate to inject column "
"aliases"
msgstr ""
"la cadena de consultas SQL, con un espacio reservado para que Hibernate "
"inserte alias de columnas"

#. Tag: para
#: query_sql.xml:206
#, no-c-format
msgid "the entities returned by the query"
msgstr "las entidades devueltas por la consulta"

#. Tag: para
#: query_sql.xml:210
#, no-c-format
msgid ""
"The {cat.*} and {mother.*} notation used above is a shorthand for \"all "
"properties\". Alternatively, you can list the columns explicitly, but even "
"in this case Hibernate injects the SQL column aliases for each property. The "
"placeholder for a column alias is just the property name qualified by the "
"table alias. In the following example, you retrieve Cats and their mothers "
"from a different table (cat_log) to the one declared in the mapping "
"metadata. You can even use the property aliases in the where clause."
msgstr ""
"La anotación {cat.*} y {mother.*} que se utilizó anteriormente es la "
"abreviatura para \"todas las propiedades\". Opcionalmente puede enumerar las "
"columnas explícitamente, pero inclusive en este caso Hibernate inyecta los "
"alias de columnas SQL para cada propiedad. El espacio para un alias de "
"columna es sólamente el nombre calificado de la propiedad del alias de la "
"tabla. En el siguiente ejemplo, recuperamos Cats y sus madres desde una "
"tabla diferente (cat_log) a la declarada en los meta datos de mapeo. "
"Inclusive puede utilizar los alias de propiedad en la cláusula where."

#. Tag: programlisting
#: query_sql.xml:219
#, no-c-format
msgid ""
"String sql = \"SELECT ID as {c.id}, NAME as {c.name}, \" +\n"
"         \"BIRTHDATE as {c.birthDate}, MOTHER_ID as {c.mother}, {mother.*} "
"\" +\n"
"         \"FROM CAT_LOG c, CAT_LOG m WHERE {c.mother} = c.ID\";\n"
"\n"
"List loggedCats = sess.createSQLQuery(sql)\n"
"        .addEntity(\"cat\", Cat.class)\n"
"        .addEntity(\"mother\", Cat.class).list()"
msgstr ""

#. Tag: title
#: query_sql.xml:222
#, no-c-format
msgid "Alias and property references"
msgstr "Referencias de propiedad y alias"

#. Tag: para
#: query_sql.xml:224
#, no-c-format
msgid ""
"In most cases the above alias injection is needed. For queries relating to "
"more complex mappings, like composite properties, inheritance "
"discriminators, collections etc., you can use specific aliases that allow "
"Hibernate to inject the proper aliases."
msgstr ""
"Para la mayoría de los casos, se necesita la inyección del alias anterior. "
"Para las consultas relacionadas con mapeos más complejos como propiedades "
"compuestas, discriminadores de herencia, colecciones, etc, existen alias "
"especificos a utilizar para permitir que Hibernate inyecte los alias "
"apropiados."

#. Tag: para
#: query_sql.xml:229
#, no-c-format
msgid ""
"The following table shows the different ways you can use the alias "
"injection. Please note that the alias names in the result are simply "
"examples; each alias will have a unique and probably different name when "
"used."
msgstr ""
"La siguiente tabla muestra las diferentes maneras de utilizar la inyección "
"de alias. Note que los nombres alias en el resultado son simplemente "
"ejemplos; cada alias tendrá un nombre único y probablemente diferente cuando "
"se utilice."

#. Tag: title
#: query_sql.xml:235
#, no-c-format
msgid "Alias injection names"
msgstr "Nombres con inyección alias"

#. Tag: entry
#: query_sql.xml:246
#, no-c-format
msgid "Description"
msgstr "Descripción"

#. Tag: entry
#: query_sql.xml:248
#, no-c-format
msgid "Syntax"
msgstr "Sintaxis"

#. Tag: entry
#: query_sql.xml:250
#, no-c-format
msgid "Example"
msgstr "Ejemplo"

#. Tag: entry
#: query_sql.xml:256
#, no-c-format
msgid "A simple property"
msgstr "Una propiedad simple"

#. Tag: literal
#: query_sql.xml:258
#, fuzzy, no-c-format
msgid "{[aliasname].[propertyname]"
msgstr "<literal>{[aliasname].[propertyname]"

#. Tag: literal
#: query_sql.xml:260
#, fuzzy, no-c-format
msgid "A_NAME as {item.name}"
msgstr "<literal>A_NAME as {item.name}"

#. Tag: entry
#: query_sql.xml:264
#, no-c-format
msgid "A composite property"
msgstr "Una propiedad compuesta"

#. Tag: literal
#: query_sql.xml:266
#, fuzzy, no-c-format
msgid "{[aliasname].[componentname].[propertyname]}"
msgstr "<literal>{[aliasname].[componentname].[propertyname]}"

#. Tag: literal
#: query_sql.xml:268
#, fuzzy, no-c-format
msgid "CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}"
msgstr ""
"<literal>CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}"

#. Tag: literal
#: query_sql.xml:277
#, fuzzy, no-c-format
msgid "DISC as {item.class}"
msgstr "<literal>DISC as {item.class}"

#. Tag: entry
#: query_sql.xml:281
#, no-c-format
msgid "All properties of an entity"
msgstr "Todas las propiedades de una entidad"

#. Tag: literal
#: query_sql.xml:283 query_sql.xml:331
#, fuzzy, no-c-format
msgid "{[aliasname].*}"
msgstr "<literal>{[aliasname].*}"

#. Tag: literal
#: query_sql.xml:285
#, no-c-format
msgid "{item.*}"
msgstr ""

#. Tag: entry
#: query_sql.xml:289
#, no-c-format
msgid "A collection key"
msgstr "Una clave de colección"

#. Tag: literal
#: query_sql.xml:291
#, fuzzy, no-c-format
msgid "{[aliasname].key}"
msgstr "<literal>{[aliasname].key}"

#. Tag: literal
#: query_sql.xml:293
#, fuzzy, no-c-format
msgid "ORGID as {coll.key}"
msgstr "<literal>ORGID as {coll.key}"

#. Tag: entry
#: query_sql.xml:297
#, no-c-format
msgid "The id of an collection"
msgstr "La identificación -id- de una colección"

#. Tag: literal
#: query_sql.xml:299
#, fuzzy, no-c-format
msgid "{[aliasname].id}"
msgstr "<literal>{[aliasname].id}"

#. Tag: literal
#: query_sql.xml:301
#, fuzzy, no-c-format
msgid "EMPID as {coll.id}"
msgstr "<literal>EMPID as {coll.id}"

#. Tag: entry
#: query_sql.xml:305
#, no-c-format
msgid "The element of an collection"
msgstr "El elemento de una colección"

#. Tag: literal
#: query_sql.xml:307
#, fuzzy, no-c-format
msgid "{[aliasname].element}"
msgstr "<literal>{[aliasname].element}"

#. Tag: literal
#: query_sql.xml:309
#, fuzzy, no-c-format
msgid "XID as {coll.element}"
msgstr "<literal>XID as {coll.element}"

#. Tag: entry
#: query_sql.xml:313
#, no-c-format
msgid "property of the element in the collection"
msgstr "propiedad del elemento en la colección "

#. Tag: literal
#: query_sql.xml:315
#, fuzzy, no-c-format
msgid "{[aliasname].element.[propertyname]}"
msgstr "<literal>{[aliasname].element.[propertyname]}"

#. Tag: literal
#: query_sql.xml:317
#, fuzzy, no-c-format
msgid "NAME as {coll.element.name}"
msgstr "<literal>NAME as {coll.element.name}"

#. Tag: entry
#: query_sql.xml:321
#, no-c-format
msgid "All properties of the element in the collection"
msgstr "Todas las propiedades del elemeto en la colección"

#. Tag: literal
#: query_sql.xml:323
#, fuzzy, no-c-format
msgid "{[aliasname].element.*}"
msgstr "<literal>{[aliasname].element.*}"

#. Tag: literal
#: query_sql.xml:325
#, fuzzy, no-c-format
msgid "{coll.element.*}"
msgstr "<literal>{coll.element.*}"

#. Tag: entry
#: query_sql.xml:329
#, no-c-format
msgid "All properties of the collection"
msgstr "Todas las propiedades de la colección "

#. Tag: literal
#: query_sql.xml:333
#, no-c-format
msgid "{coll.*}"
msgstr ""

#. Tag: title
#: query_sql.xml:342
#, no-c-format
msgid "Returning non-managed entities"
msgstr "Devolución de entidades no-administradas"

#. Tag: para
#: query_sql.xml:344
#, no-c-format
msgid ""
"It is possible to apply a ResultTransformer to native SQL queries, allowing "
"it to return non-managed entities."
msgstr ""
"Es posible aplicar un ResultTransformer para consultas SQL nativas, "
"permitiéndole retornar entidades no-administradas."

#. Tag: programlisting
#: query_sql.xml:347
#, no-c-format
msgid ""
"sess.createSQLQuery(\"SELECT NAME, BIRTHDATE FROM CATS\")\n"
"        .setResultTransformer(Transformers.aliasToBean(CatDTO.class))"
msgstr ""

#. Tag: para
#: query_sql.xml:357
#, no-c-format
msgid "a result transformer"
msgstr "un transformador de resultado"

#. Tag: para
#: query_sql.xml:361
#, no-c-format
msgid ""
"The above query will return a list of <literal>CatDTO which has "
"been instantiated and injected the values of NAME and BIRTHNAME into its "
"corresponding properties or fields."
msgstr ""
"La consulta anterior devolverá una lista de <literal>CatDTO a la "
"cual se ha instanciado e inyectado los valores de NOMBRE y FECHA DE "
"NACIMIENTO en su propiedades o campos correspondientes."

#. Tag: title
#: query_sql.xml:367
#, no-c-format
msgid "Handling inheritance"
msgstr "Manejo de herencias"

#. Tag: para
#: query_sql.xml:369
#, no-c-format
msgid ""
"Native SQL queries which query for entities that are mapped as part of an "
"inheritance must include all properties for the baseclass and all its "
"subclasses."
msgstr ""
"Las consultas SQL nativas, las cuales consultan por entidades que son "
"mapeadas como parte de una herencia tienen que incluir todas las propiedades "
"para la clase base y todas sus subclases."

#. Tag: title
#: query_sql.xml:375
#, no-c-format
msgid "Parameters"
msgstr "Parámetros"

#. Tag: para
#: query_sql.xml:377
#, no-c-format
msgid "Native SQL queries support positional as well as named parameters:"
msgstr ""
"Las consultas SQL nativas soportan parámetros nombrados así como "
"posicionales:"

#. Tag: programlisting
#: query_sql.xml:380
#, no-c-format
msgid ""
"Query query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like ?\")."
"addEntity(Cat.class);\n"
"List pusList = query.setString(0, \"Pus%\").list();\n"
"     \n"
"query = sess.createSQLQuery(\"SELECT * FROM CATS WHERE NAME like :name\")."
"addEntity(Cat.class);\n"
"List pusList = query.setString(\"name\", \"Pus%\").list();"
msgstr ""

#. Tag: title
#: query_sql.xml:385
#, no-c-format
msgid "Named SQL queries"
msgstr "Consultas SQL nombradas"

#. Tag: para
#: query_sql.xml:387
#, fuzzy, no-c-format
msgid ""
"Named SQL queries can also be defined in the mapping document and called in "
"exactly the same way as a named HQL query (see <xref linkend=\"objectstate-"
"querying-executing-named\"/>). In this case, you do <emphasis>not "
"need to call <literal>addEntity()."
msgstr ""
"Las consultas SQL nombradas se pueden definir en el documento de mapeo y se "
"pueden llamar de la misma manera que una consulta HQL nombrada. En este "
"caso, <emphasis>no necesitamos llamar a addEntity() element is use to join "
"associations and the <literal><load-collection> element is "
"used to define queries which initialize collections,"
msgstr ""
"El elemento <literal><return-join> se utiliza para unir "
"asociaciones y el elemento <literal><load-collection> se usa "
"para definir consultas, las cuales dan inicio a colecciones."

#. Tag: title
#: query_sql.xml:411
#, no-c-format
msgid "Named sql query with association"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:413
#, no-c-format
msgid ""
"<sql-query name=\"personsWith\">\n"
"    <return alias=\"person\" class=\"eg.Person\"/>\n"
"    <return-join alias=\"address\" property=\"person.mailingAddress\"/"
">\n"
"    SELECT person.NAME AS {person.name},\n"
"           person.AGE AS {person.age},\n"
"           person.SEX AS {person.sex},\n"
"           address.STREET AS {address.street},\n"
"           address.CITY AS {address.city},\n"
"           address.STATE AS {address.state},\n"
"           address.ZIP AS {address.zip}\n"
"    FROM PERSON person\n"
"    JOIN ADDRESS address\n"
"        ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n"
"    WHERE person.NAME LIKE :namePattern\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:416
#, no-c-format
msgid ""
"A named SQL query may return a scalar value. You must declare the column "
"alias and Hibernate type using the <literal><return-scalar> "
"element:"
msgstr ""
"Una consulta SQL nombrada puede devolver un valor escalar. Tiene que "
"declarar el alias de la columna y el tipo de Hibernate utilizando el "
"elemento <literal><return-scalar>:"

#. Tag: title
#: query_sql.xml:421
#, no-c-format
msgid "Named query returning a scalar"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:423
#, no-c-format
msgid ""
"<sql-query name=\"mySqlQuery\">\n"
"    <return-scalar column=\"name\" type=\"string\"/>\n"
"    <return-scalar column=\"age\" type=\"long\"/>\n"
"    SELECT p.NAME AS name, \n"
"           p.AGE AS age,\n"
"    FROM PERSON p WHERE p.NAME LIKE 'Hiber%'\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:426
#, no-c-format
msgid ""
"You can externalize the resultset mapping information in a <literal><"
"resultset></literal> element which will allow you to either reuse them "
"across several named queries or through the <literal>setResultSetMapping(), el cual le permitirá "
"reutilizarlos a través de consultas nombradas o por medio de la API "
"<literal>setResultSetMapping()."

#. Tag: title
#: query_sql.xml:432
#, no-c-format
msgid "<resultset> mapping used to externalize mapping information"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:435
#, no-c-format
msgid ""
"<resultset name=\"personAddress\">\n"
"    <return alias=\"person\" class=\"eg.Person\"/>\n"
"    <return-join alias=\"address\" property=\"person.mailingAddress\"/"
">\n"
"</resultset>\n"
"\n"
"<sql-query name=\"personsWith\" resultset-ref=\"personAddress\">\n"
"    SELECT person.NAME AS {person.name},\n"
"           person.AGE AS {person.age},\n"
"           person.SEX AS {person.sex},\n"
"           address.STREET AS {address.street},\n"
"           address.CITY AS {address.city},\n"
"           address.STATE AS {address.state},\n"
"           address.ZIP AS {address.zip}\n"
"    FROM PERSON person\n"
"    JOIN ADDRESS address\n"
"        ON person.ID = address.PERSON_ID AND address.TYPE='MAILING'\n"
"    WHERE person.NAME LIKE :namePattern\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:438
#, no-c-format
msgid ""
"You can, alternatively, use the resultset mapping information in your hbm "
"files directly in java code."
msgstr ""
"Opcionalmente, puede utilizar el grupo de resultados mapeando la información "
"en sus archivos hbm directamente en código java."

#. Tag: title
#: query_sql.xml:442
#, no-c-format
msgid "Programmatically specifying the result mapping information"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:445
#, no-c-format
msgid ""
"List cats = sess.createSQLQuery(\n"
"        \"select {cat.*}, {kitten.*} from cats cat, cats kitten where kitten."
"mother = cat.id\"\n"
"    )\n"
"    .setResultSetMapping(\"catAndKitten\")\n"
"    .list();"
msgstr ""

#. Tag: para
#: query_sql.xml:448
#, no-c-format
msgid ""
"So far we have only looked at externalizing SQL queries using Hibernate "
"mapping files. The same concept is also available with anntations and is "
"called named native queries. You can use <classname>@NamedNativeQuery@NamedNativeQueries) in conjunction with "
"<literal>@SqlResultSetMapping (@SqlResultSetMappings@NamedQuery, "
"<classname>@NamedNativeQuery and @SqlResultSetMapping parameter is defined in "
"<literal>@NamedNativeQuery. It represents the name of a defined "
"<literal>@SqlResultSetMapping. The resultset mapping declares the "
"entities retrieved by this native query. Each field of the entity is bound "
"to an SQL alias (or column name). All fields of the entity including the "
"ones of subclasses and the foreign key columns of related entities have to "
"be present in the SQL query. Field definitions are optional provided that "
"they map to the same column name as the one declared on the class property. "
"In the example 2 entities, <literal>Night and Area element should be used for each "
"foreign key column. The <literal>@FieldResult name is composed of "
"the property name for the relationship, followed by a dot (\".\"), followed "
"by the name or the field or property of the primary key. This can be seen in "
"<xref linkend=\"example-field-result-annotation-with-associations\"/>."
msgstr ""

#. Tag: title
#: query_sql.xml:490
#, no-c-format
msgid ""
"Named SQL query using <classname>@NamedNativeQuery together with "
"<classname>@SqlResultSetMapping"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:493
#, no-c-format
msgid ""
"@NamedNativeQuery(name=\"night&area\", query=\"select night.id nid, "
"night.night_duration, \"\n"
"    + \" night.night_date, area.id aid, night.area_id, area.name \"\n"
"    + \"from Night night, Area area where night.area_id = area.id\", \n"
"                  resultSetMapping=\"joinMapping\")\n"
"@SqlResultSetMapping(name=\"joinMapping\", entities={\n"
"    @EntityResult(entityClass=Night.class, fields = {\n"
"        @FieldResult(name=\"id\", column=\"nid\"),\n"
"        @FieldResult(name=\"duration\", column=\"night_duration\"),\n"
"        @FieldResult(name=\"date\", column=\"night_date\"),\n"
"        @FieldResult(name=\"area\", column=\"area_id\"),\n"
"        discriminatorColumn=\"disc\"\n"
"    }),\n"
"    @EntityResult(entityClass=org.hibernate.test.annotations.query.Area."
"class, fields = {\n"
"        @FieldResult(name=\"id\", column=\"aid\"),\n"
"        @FieldResult(name=\"name\", column=\"name\")\n"
"    })\n"
"    }\n"
")"
msgstr ""

#. Tag: title
#: query_sql.xml:497
#, no-c-format
msgid "Implicit result set mapping"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:499
#, no-c-format
msgid ""
"@Entity\n"
"@SqlResultSetMapping(name=\"implicit\",\n"
"                     entities=@EntityResult(entityClass=SpaceShip.class))\n"
"@NamedNativeQuery(name=\"implicitSample\", \n"
"                  query=\"select * from SpaceShip\", \n"
"                  resultSetMapping=\"implicit\")\n"
"public class SpaceShip {\n"
"    private String name;\n"
"    private String model;\n"
"    private double speed;\n"
"\n"
"    @Id\n"
"    public String getName() {\n"
"        return name;\n"
"    }\n"
"\n"
"    public void setName(String name) {\n"
"        this.name = name;\n"
"    }\n"
"\n"
"    @Column(name=\"model_txt\")\n"
"    public String getModel() {\n"
"        return model;\n"
"    }\n"
"\n"
"    public void setModel(String model) {\n"
"        this.model = model;\n"
"    }\n"
"\n"
"    public double getSpeed() {\n"
"        return speed;\n"
"    }\n"
"\n"
"    public void setSpeed(double speed) {\n"
"        this.speed = speed;\n"
"    }\n"
"}"
msgstr ""

#. Tag: title
#: query_sql.xml:503
#, no-c-format
msgid "Using dot notation in @FieldResult for specifying associations"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:506
#, no-c-format
msgid ""
"@Entity\n"
"@SqlResultSetMapping(name=\"compositekey\",\n"
"        entities=@EntityResult(entityClass=SpaceShip.class,\n"
"            fields = {\n"
"                    @FieldResult(name=\"name\", column = \"name\"),\n"
"                    @FieldResult(name=\"model\", column = \"model\"),\n"
"                    @FieldResult(name=\"speed\", column = \"speed\"),\n"
"                    @FieldResult(name=\"captain.firstname\", column = "
"\"firstn\"),\n"
"                    @FieldResult(name=\"captain.lastname\", column = \"lastn"
"\"),\n"
"                    @FieldResult(name=\"dimensions.length\", column = "
"\"length\"),\n"
"                    @FieldResult(name=\"dimensions.width\", column = \"width"
"\")\n"
"                    }),\n"
"        columns = { @ColumnResult(name = \"surface\"),\n"
"                    @ColumnResult(name = \"volume\") } )\n"
"\n"
"@NamedNativeQuery(name=\"compositekey\",\n"
"    query=\"select name, model, speed, lname as lastn, fname as firstn, "
"length, width, length * width as surface from SpaceShip\", \n"
"    resultSetMapping=\"compositekey\")\n"
"} )\n"
"public class SpaceShip {\n"
"    private String name;\n"
"    private String model;\n"
"    private double speed;\n"
"    private Captain captain;\n"
"    private Dimensions dimensions;\n"
"\n"
"    @Id\n"
"    public String getName() {\n"
"        return name;\n"
"    }\n"
"\n"
"    public void setName(String name) {\n"
"        this.name = name;\n"
"    }\n"
"\n"
"    @ManyToOne(fetch= FetchType.LAZY)\n"
"    @JoinColumns( {\n"
"            @JoinColumn(name=\"fname\", referencedColumnName = \"firstname"
"\"),\n"
"            @JoinColumn(name=\"lname\", referencedColumnName = \"lastname"
"\")\n"
"            } )\n"
"    public Captain getCaptain() {\n"
"        return captain;\n"
"    }\n"
"\n"
"    public void setCaptain(Captain captain) {\n"
"        this.captain = captain;\n"
"    }\n"
"\n"
"    public String getModel() {\n"
"        return model;\n"
"    }\n"
"\n"
"    public void setModel(String model) {\n"
"        this.model = model;\n"
"    }\n"
"\n"
"    public double getSpeed() {\n"
"        return speed;\n"
"    }\n"
"\n"
"    public void setSpeed(double speed) {\n"
"        this.speed = speed;\n"
"    }\n"
"\n"
"    public Dimensions getDimensions() {\n"
"        return dimensions;\n"
"    }\n"
"\n"
"    public void setDimensions(Dimensions dimensions) {\n"
"        this.dimensions = dimensions;\n"
"    }\n"
"}\n"
"\n"
"@Entity\n"
"@IdClass(Identity.class)\n"
"public class Captain implements Serializable {\n"
"    private String firstname;\n"
"    private String lastname;\n"
"\n"
"    @Id\n"
"    public String getFirstname() {\n"
"        return firstname;\n"
"    }\n"
"\n"
"    public void setFirstname(String firstname) {\n"
"        this.firstname = firstname;\n"
"    }\n"
"\n"
"    @Id\n"
"    public String getLastname() {\n"
"        return lastname;\n"
"    }\n"
"\n"
"    public void setLastname(String lastname) {\n"
"        this.lastname = lastname;\n"
"    }\n"
"}"
msgstr ""

#. Tag: para
#: query_sql.xml:510
#, no-c-format
msgid ""
"If you retrieve a single entity using the default mapping, you can specify "
"the <literal>resultClass attribute instead of "
"<literal>resultSetMapping:"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:514
#, no-c-format
msgid ""
"@NamedNativeQuery(name=\"implicitSample\", query=\"select * from SpaceShip"
"\", resultClass=SpaceShip.class)\n"
"public class SpaceShip {"
msgstr ""

#. Tag: para
#: query_sql.xml:517
#, no-c-format
msgid ""
"In some of your native queries, you'll have to return scalar values, for "
"example when building report queries. You can map them in the "
"<literal>@SqlResultsetMapping through @ColumnResult"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:527
#, no-c-format
msgid ""
"@SqlResultSetMapping(name=\"scalar\", columns=@ColumnResult(name=\"dimension"
"\"))\n"
"@NamedNativeQuery(name=\"scalar\", query=\"select length*width as dimension "
"from SpaceShip\", resultSetMapping=\"scalar\")"
msgstr ""

#. Tag: para
#: query_sql.xml:530
#, no-c-format
msgid ""
"An other query hint specific to native queries has been introduced: "
"<literal>org.hibernate.callable which can be true or false "
"depending on whether the query is a stored procedure or not."
msgstr ""

#. Tag: title
#: query_sql.xml:535
#, no-c-format
msgid "Using return-property to explicitly specify column/alias names"
msgstr ""
"Utilización de la propiedad return para especificar explícitamente los "
"nombres de columnas/alias"

#. Tag: para
#: query_sql.xml:538
#, no-c-format
msgid ""
"You can explicitly tell Hibernate what column aliases to use with "
"<literal><return-property>, instead of using the {}"
"</literal>-syntax to let Hibernate inject its own aliases.For example:"
msgstr ""
"Con <literal><return-property> usted puede decirle a "
"Hibernate explícitamente qué alias de columnas se deben utilizar, en vez de "
"utilizar la sintaxis <literal>{} para dejar que Hibernate inyecte "
"sus propios alias. Por ejemplo:"

#. Tag: programlisting
#: query_sql.xml:543
#, no-c-format
msgid ""
"<sql-query name=\"mySqlQuery\">\n"
"    <return alias=\"person\" class=\"eg.Person\">\n"
"        <return-property name=\"name\" column=\"myName\"/>\n"
"        <return-property name=\"age\" column=\"myAge\"/>\n"
"        <return-property name=\"sex\" column=\"mySex\"/>\n"
"    </return>\n"
"    SELECT person.NAME AS myName,\n"
"           person.AGE AS myAge,\n"
"           person.SEX AS mySex,\n"
"    FROM PERSON person WHERE person.NAME LIKE :name\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:545
#, no-c-format
msgid ""
"<literal><return-property> also works with multiple columns. "
"This solves a limitation with the <literal>{}-syntax which cannot "
"allow fine grained control of multi-column properties."
msgstr ""
"<literal><return-property> también funciona con columnas "
"múltiples. Esto resuelve una limitación con la sintaxis <literal>{} was used in "
"combination with the <literal>{}-syntax for injection. This allows "
"users to choose how they want to refer column and properties."
msgstr ""
"En este ejemplo utilizamos <literal><return-property> en "
"combinación junto con la sintaxis <literal>{} para inyección. Esto "
"le permite a los usuarios escoger cómo quieren referirse a la columna y a "
"las propiedades."

#. Tag: para
#: query_sql.xml:557
#, no-c-format
msgid ""
"If your mapping has a discriminator you must use <literal><return-"
"discriminator></literal> to specify the discriminator column."
msgstr ""
"Si su mapeo tiene un discriminador usted tiene que utilizar <literal><"
"return-discriminator></literal> para especificar la columna "
"discriminadora."

#. Tag: title
#: query_sql.xml:563
#, no-c-format
msgid "Using stored procedures for querying"
msgstr "Utilización de procedimientos para consultas"

#. Tag: para
#: query_sql.xml:565
#, no-c-format
msgid ""
"Hibernate3 provides support for queries via stored procedures and functions. "
"Most of the following documentation is equivalent for both. The stored "
"procedure/function must return a resultset as the first out-parameter to be "
"able to work with Hibernate. An example of such a stored function in Oracle "
"9 and higher is as follows:"
msgstr ""
"Hibernate 3 brinda soporte para consultas por medio de procedimientos "
"almacenados y funciones. La mayoría de la siguiente documentación es igual "
"para ambos. La función/procedimiento almacenado tiene que retornar un grupo "
"de resultados como el primer parámetro de salida para poder trabajar con "
"Hibernate. A continuación hay un ejemplo de tal función almacenada en Oracle "
"9 y posteriores:"

#. Tag: programlisting
#: query_sql.xml:571
#, no-c-format
msgid ""
"CREATE OR REPLACE FUNCTION selectAllEmployments\n"
"    RETURN SYS_REFCURSOR\n"
"AS\n"
"    st_cursor SYS_REFCURSOR;\n"
"BEGIN\n"
"    OPEN st_cursor FOR\n"
" SELECT EMPLOYEE, EMPLOYER,\n"
" STARTDATE, ENDDATE,\n"
" REGIONCODE, EID, VALUE, CURRENCY\n"
" FROM EMPLOYMENT;\n"
"      RETURN  st_cursor;\n"
" END;"
msgstr ""

#. Tag: para
#: query_sql.xml:573
#, no-c-format
msgid "To use this query in Hibernate you need to map it via a named query."
msgstr ""
"Para utilizar esta consulta en Hibernate u.d necesita mapearla por medio de "
"una consulta nombrada."

#. Tag: programlisting
#: query_sql.xml:576
#, no-c-format
msgid ""
"<sql-query name=\"selectAllEmployees_SP\" callable=\"true\">\n"
"    <return alias=\"emp\" class=\"Employment\">\n"
"        <return-property name=\"employee\" column=\"EMPLOYEE\"/>\n"
"        <return-property name=\"employer\" column=\"EMPLOYER\"/>\n"
"        <return-property name=\"startDate\" column=\"STARTDATE\"/>\n"
"        <return-property name=\"endDate\" column=\"ENDDATE\"/>\n"
"        <return-property name=\"regionCode\" column=\"REGIONCODE\"/>\n"
"        <return-property name=\"id\" column=\"EID\"/>\n"
"        <return-property name=\"salary\">\n"
"            <return-column name=\"VALUE\"/>\n"
"            <return-column name=\"CURRENCY\"/>\n"
"        </return-property>\n"
"    </return>\n"
"    { ? = call selectAllEmployments() }\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:578
#, no-c-format
msgid ""
"Stored procedures currently only return scalars and entities. <literal><"
"return-join></literal> and <load-collection> are "
"not supported."
msgstr ""
"Los procedimientos almacenados actualmente sólo retornan escalares y "
"entidades. No se soporta <literal><return-join> ni "
"<literal><load-collection> ."

#. Tag: title
#: query_sql.xml:583
#, no-c-format
msgid "Rules/limitations for using stored procedures"
msgstr "Reglas/limitaciones para utilizar procedimientos almacenados"

#. Tag: para
#: query_sql.xml:585
#, no-c-format
msgid ""
"You cannot use stored procedures with Hibernate unless you follow some "
"procedure/function rules. If they do not follow those rules they are not "
"usable with Hibernate. If you still want to use these procedures you have to "
"execute them via <literal>session.connection(). The rules are "
"different for each database, since database vendors have different stored "
"procedure semantics/syntax."
msgstr ""
"Para utilizar procedimientos almacenados con Hibernate, debe seguir ciertas "
"reglas de funciones/procedimientos. Si no siguen esas reglas entonces no se "
"pueden utilizar con Hibernate. Si todavía quiere utilizar estos "
"procedimientos tiene que ejecutarlos por medio de <literal>session.connection"
"()</literal>. Las reglas son diferentes para cada base de datos debido a que "
"los vendedores de la base de datos tienen diferentes sintaxis/semántica de "
"procedimientos almacenados."

#. Tag: para
#: query_sql.xml:593
#, no-c-format
msgid ""
"Stored procedure queries cannot be paged with <literal>setFirstResult()/"
"setMaxResults()</literal>."
msgstr ""
"Las consultas de procedimientos almacenados no se pueden llamar con "
"<literal>setFirstResult()/setMaxResults()."

#. Tag: para
#: query_sql.xml:596
#, no-c-format
msgid ""
"The recommended call form is standard SQL92: <literal>{ ? = call functionName"
"(<parameters>) }</literal> or { ? = call procedureName(<"
"parameters>}</literal>. Native call syntax is not supported."
msgstr ""
"La forma de la llamada recomendada es SQL92 estándar: <literal>{ ? = call "
"functionName(<parameters>) }</literal> o { ? = call "
"procedureName(<parameters>}</literal>. No se soporta la sintaxis de "
"llamadas nativas."

#. Tag: para
#: query_sql.xml:601
#, no-c-format
msgid "For Oracle the following rules apply:"
msgstr "Para Oracle aplican las siguientes reglas:"

#. Tag: para
#: query_sql.xml:605
#, no-c-format
msgid ""
"A function must return a result set. The first parameter of a procedure must "
"be an <literal>OUT that returns a result set. This is done by "
"using a <literal>SYS_REFCURSOR type in Oracle 9 or 10. In Oracle "
"you need to define a <literal>REF CURSOR type. See Oracle "
"literature for further information."
msgstr ""
"Una función tiene que retornar un grupo de resultados. El primer parámetro "
"de un procedimiento tiene que ser un <literal>OUT que retorna un "
"grupo de resultados. Esto se hace utilizando un tipo <literal>SYS_REFCURSORREF "
"CURSOR</literal>. Consulte la documentación de Oracle para obtener mayor "
"información."

#. Tag: para
#: query_sql.xml:614
#, no-c-format
msgid "For Sybase or MS SQL server the following rules apply:"
msgstr "Para Sybase o el servidor MS SQL aplican las siguientes reglas:"

#. Tag: para
#: query_sql.xml:618
#, no-c-format
msgid ""
"The procedure must return a result set. Note that since these servers can "
"return multiple result sets and update counts, Hibernate will iterate the "
"results and take the first result that is a result set as its return value. "
"Everything else will be discarded."
msgstr ""
"El procedimiento tiene que retornar un grupo de resultados. Observe que "
"debido a que estos servidores pueden retornar grupos de resultados múltiples "
"y cuentas actualizadas, Hibernate iterará los resultados y tomará el primer "
"resultado que sea un grupo resultados como su valor retornado. Todo lo demás "
"será descartado."

#. Tag: para
#: query_sql.xml:626
#, no-c-format
msgid ""
"If you can enable <literal>SET NOCOUNT ON in your procedure it "
"will probably be more efficient, but this is not a requirement."
msgstr ""
"Si puede habilitar <literal>SET NOCOUNT ON en su procedimiento "
"probablemente será más eficiente, pero no es un requerimiento."

#. Tag: title
#: query_sql.xml:636
#, no-c-format
msgid "Custom SQL for create, update and delete"
msgstr "Personalice SQL para crear, actualizar y borrar"

#. Tag: para
#: query_sql.xml:638
#, fuzzy, no-c-format
msgid ""
"Hibernate3 can use custom SQL for create, update, and delete operations. The "
"SQL can be overridden at the statement level or inidividual column level. "
"This section describes statement overrides. For columns, see <xref linkend="
"\"mapping-column-read-and-write\"/>. <xref linkend=\"example-custom-crdu-via-"
"annotations\"/> shows how to define custom SQL operatons using annotations."
msgstr ""
"Hibernate3 puede utilizar SQL personalizado para crear, actualizar y borrar "
"operaciones. El SQL se puede sobreescribir a nivel de declaración o a nivel "
"de columna individual. Esta sección describe la sobreescritua de "
"declaraciones. Para las columnas consulte <xref linkend=\"mapping-column-"
"read-and-write\" />."

#. Tag: title
#: query_sql.xml:646
#, no-c-format
msgid "Custom CRUD via annotations"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:648
#, no-c-format
msgid ""
"@Entity\n"
"@Table(name=\"CHAOS\")\n"
"@SQLInsert( sql=\"INSERT INTO CHAOS(size, name, nickname, id) VALUES(?,upper"
"(?),?,?)\")\n"
"@SQLUpdate( sql=\"UPDATE CHAOS SET size = ?, name = upper(?), nickname = ? "
"WHERE id = ?\")\n"
"@SQLDelete( sql=\"DELETE CHAOS WHERE id = ?\")\n"
"@SQLDeleteAll( sql=\"DELETE CHAOS\")\n"
"@Loader(namedQuery = \"chaos\")\n"
"@NamedNativeQuery(name=\"chaos\", query=\"select id, size, name, lower"
"( nickname ) as nickname from CHAOS where id= ?\", resultClass = Chaos."
"class)\n"
"public class Chaos {\n"
"    @Id\n"
"    private Long id;\n"
"    private Long size;\n"
"    private String name;\n"
"    private String nickname;"
msgstr ""

#. Tag: para
#: query_sql.xml:651
#, no-c-format
msgid ""
"<literal>@SQLInsert, @SQLUpdate, "
"<literal>@SQLDelete, @SQLDeleteAll respectively "
"override the INSERT, UPDATE, DELETE, and DELETE all statement. The same can "
"be achieved using Hibernate mapping files and the <literal><sql-insert>"
"</literal>, <sql-update> and <sql-"
"delete></literal> nodes. This can be seen in  attribute to true. In "
"annotations as well as in xml."
msgstr ""

#. Tag: para
#: query_sql.xml:670
#, no-c-format
msgid ""
"To check that the execution happens correctly, Hibernate allows you to "
"define one of those three strategies:"
msgstr ""

#. Tag: para
#: query_sql.xml:675
#, no-c-format
msgid ""
"none: no check is performed: the store procedure is expected to fail upon "
"issues"
msgstr ""

#. Tag: para
#: query_sql.xml:680
#, no-c-format
msgid "count: use of rowcount to check that the update is successful"
msgstr ""

#. Tag: para
#: query_sql.xml:685
#, no-c-format
msgid ""
"param: like COUNT but using an output parameter rather that the standard "
"mechanism"
msgstr ""

#. Tag: para
#: query_sql.xml:690
#, no-c-format
msgid ""
"To define the result check style, use the <literal>check parameter "
"which is again available in annoations as well as in xml."
msgstr ""

#. Tag: para
#: query_sql.xml:693
#, no-c-format
msgid ""
"You can use the exact same set of annotations respectively xml nodes to "
"override the collection related statements -see <xref linkend=\"example-"
"overriding-sql-collections-annotations\"/>."
msgstr ""

#. Tag: title
#: query_sql.xml:698
#, no-c-format
msgid "Overriding SQL statements for collections using annotations"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:701
#, no-c-format
msgid ""
"@OneToMany\n"
"@JoinColumn(name=\"chaos_fk\")\n"
"@SQLInsert( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = ? where id = ?\")\n"
"@SQLDelete( sql=\"UPDATE CASIMIR_PARTICULE SET chaos_fk = null where id = ?"
"\")\n"
"private Set<CasimirParticle> particles = new HashSet<"
"CasimirParticle>();"
msgstr ""

#. Tag: para
#: query_sql.xml:705
#, fuzzy, no-c-format
msgid ""
"The parameter order is important and is defined by the order Hibernate "
"handles properties. You can see the expected order by enabling debug logging "
"for the <literal>org.hibernate.persister.entity level. With this "
"level enabled Hibernate will print out the static SQL that is used to "
"create, update, delete etc. entities. (To see the expected sequence, "
"remember to not include your custom SQL through annotations or mapping files "
"as that will override the Hibernate generated static sql)"
msgstr ""
"Puede ver el orden esperado habilitando el registro de depuración para el "
"nivel <literal>org.hibernate.persister.entity. Con este nivel "
"habilitado Hibernate imprimirá el SQL estático que se utiliza para crear, "
"actualizar, borrar, etc, entidades, ( para ver la secuencia esperada, "
"recuerde no incluir su SQL personalizado en los archivos de mapeo ya que eso "
"sobrescribirá el sql estático generado por Hibernate)."

#. Tag: para
#: query_sql.xml:715
#, no-c-format
msgid ""
"Overriding SQL statements for secondary tables is also possible using "
"<literal>@org.hibernate.annotations.Table and either (or all) "
"attributes <literal>sqlInsert, sqlUpdate, "
"<literal>sqlDelete:"
msgstr ""

#. Tag: title
#: query_sql.xml:721
#, no-c-format
msgid "Overriding SQL statements for secondary tables"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:723
#, no-c-format
msgid ""
"@Entity\n"
"@SecondaryTables({\n"
"    @SecondaryTable(name = \"`Cat nbr1`\"),\n"
"    @SecondaryTable(name = \"Cat2\"})\n"
"@org.hibernate.annotations.Tables( {\n"
"    @Table(appliesTo = \"Cat\", comment = \"My cat table\" ),\n"
"    @Table(appliesTo = \"Cat2\", foreignKey = @ForeignKey(name=\"FK_CAT2_CAT"
"\"), fetch = FetchMode.SELECT,\n"
"        sqlInsert=@SQLInsert(sql=\"insert into Cat2(storyPart2, id) values"
"(upper(?), ?)\") )\n"
"} )\n"
"public class Cat implements Serializable {"
msgstr ""

#. Tag: para
#: query_sql.xml:726
#, no-c-format
msgid ""
"The previous example also shows that you can give a comment to a given table "
"(primary or secondary): This comment will be used for DDL generation."
msgstr ""

#. Tag: para
#: query_sql.xml:731
#, fuzzy, no-c-format
msgid ""
"The SQL is directly executed in your database, so you can use any dialect "
"you like. This will, however, reduce the portability of your mapping if you "
"use database specific SQL."
msgstr ""
"El SQL se ejecuta directamente en su base de datos asi que usted es libre de "
"utilizar cualquier dialecto que desee. Esto reducirá la portabilidad de su "
"mapeo si utiliza una base de datos especifica de SQL."

#. Tag: para
#: query_sql.xml:736
#, fuzzy, no-c-format
msgid ""
"Last but not least, stored procedures are in most cases required to return "
"the number of rows inserted, updated and deleted. Hibernate always registers "
"the first statement parameter as a numeric output parameter for the CUD "
"operations:"
msgstr ""
"En la mayoría de los casos se requiere que los procedimientos almacenados "
"retornen el número de filas insertadas, actualizadas y borradas ya que "
"Hibernate tiene algunas verificaciones en tiempo de ejecución para el éxito "
"de la declaración. Hibernate siempre registra el primer parámetro de la "
"declaración como un parámetro de la salida numérica para las operaciones CUD:"

#. Tag: title
#: query_sql.xml:742
#, no-c-format
msgid "Stored procedures and their return value"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:744
#, no-c-format
msgid ""
"CREATE OR REPLACE FUNCTION updatePerson (uid IN NUMBER, uname IN VARCHAR2)\n"
"    RETURN NUMBER IS\n"
"BEGIN\n"
"\n"
"    update PERSON\n"
"    set\n"
"        NAME = uname,\n"
"    where\n"
"        ID = uid;\n"
"\n"
"    return SQL%ROWCOUNT;\n"
"\n"
"END updatePerson;"
msgstr ""

#. Tag: title
#: query_sql.xml:749
#, no-c-format
msgid "Custom SQL for loading"
msgstr "Personalice SQL para cargar"

#. Tag: para
#: query_sql.xml:751
#, fuzzy, no-c-format
msgid ""
"You can also declare your own SQL (or HQL) queries for entity loading. As "
"with inserts, updates, and deletes, this can be done at the individual "
"column level as described in <xref linkend=\"mapping-column-read-and-write\"/"
"> or at the statement level. Here is an example of a statement level "
"override:"
msgstr ""
"También puede declarar su propias peticiones SQL (o HQL) para cargar "
"entidades. Así como con las inserciones, actualizaciones y los borrados, "
"esto se puede realizar a nivel de columna individual tal como se describe en "
"<xref linkend=\"mapping-column-read-and-write\" /> o a nivel de declaración. "
"Este es un ejemplo de una sobreescritura a nivel de declaración: "

#. Tag: programlisting
#: query_sql.xml:757
#, no-c-format
msgid ""
"<sql-query name=\"person\">\n"
"    <return alias=\"pers\" class=\"Person\" lock-mode=\"upgrade\"/>\n"
"    SELECT NAME AS {pers.name}, ID AS {pers.id}\n"
"    FROM PERSON\n"
"    WHERE ID=?\n"
"    FOR UPDATE\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:759
#, no-c-format
msgid ""
"This is just a named query declaration, as discussed earlier. You can "
"reference this named query in a class mapping:"
msgstr ""
"Esta es tan sólo una declaración de consulta nombrada, como se discutió "
"anteriormente. Puede referenciar esta consulta nombrada en un mapeo de clase:"

#. Tag: programlisting
#: query_sql.xml:762
#, no-c-format
msgid ""
"<class name=\"Person\">\n"
"    <id name=\"id\">\n"
"        <generator class=\"increment\"/>\n"
"    </id>\n"
"    <property name=\"name\" not-null=\"true\"/>\n"
"    <loader query-ref=\"person\"/>\n"
"</class>"
msgstr ""

#. Tag: para
#: query_sql.xml:764
#, no-c-format
msgid "This even works with stored procedures."
msgstr "Esto funciona inclusive con procedimientos almacenados."

#. Tag: para
#: query_sql.xml:766
#, no-c-format
msgid "You can even define a query for collection loading:"
msgstr "Puede incluso definir una consulta para la carga de colección:"

#. Tag: programlisting
#: query_sql.xml:768
#, no-c-format
msgid ""
"<set name=\"employments\" inverse=\"true\">\n"
"    <key/>\n"
"    <one-to-many class=\"Employment\"/>\n"
"    <loader query-ref=\"employments\"/>\n"
"</set>"
msgstr ""

#. Tag: programlisting
#: query_sql.xml:770
#, no-c-format
msgid ""
"<sql-query name=\"employments\">\n"
"    <load-collection alias=\"emp\" role=\"Person.employments\"/>\n"
"    SELECT {emp.*}\n"
"    FROM EMPLOYMENT emp\n"
"    WHERE EMPLOYER = :id\n"
"    ORDER BY STARTDATE ASC, EMPLOYEE ASC\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:772
#, no-c-format
msgid ""
"You can also define an entity loader that loads a collection by join "
"fetching:"
msgstr ""
"También puede definir un cargador de entidad que cargue una colección con "
"una unión temprana:"

#. Tag: programlisting
#: query_sql.xml:775
#, no-c-format
msgid ""
"<sql-query name=\"person\">\n"
"    <return alias=\"pers\" class=\"Person\"/>\n"
"    <return-join alias=\"emp\" property=\"pers.employments\"/>\n"
"    SELECT NAME AS {pers.*}, {emp.*}\n"
"    FROM PERSON pers\n"
"    LEFT OUTER JOIN EMPLOYMENT emp\n"
"        ON pers.ID = emp.PERSON_ID\n"
"    WHERE ID=?\n"
"</sql-query>"
msgstr ""

#. Tag: para
#: query_sql.xml:777
#, no-c-format
msgid ""
"The annotation equivalent <literal><loader> is the @Loader "
"annotation as seen in <xref linkend=\"example-custom-crdu-via-annotations\"/"
">."
msgstr ""

#~ msgid "<literal>{item.*}"
#~ msgstr "<literal>{item.*}"

#~ msgid "<literal>{coll.*}"
#~ msgstr "<literal>{coll.*}"

#~ msgid ""
#~ "The class and collection persisters in Hibernate already contain a set of "
#~ "configuration time generated strings (insertsql, deletesql, updatesql "
#~ "etc.). The mapping tags <literal><sql-insert>, "
#~ "<literal><sql-delete>, and <sql-update><sql-delete> y "
#~ "<literal><sql-update> sobrescriben estas cadenas:"

#~ msgid ""
#~ "Stored procedures are supported if the <literal>callable "
#~ "attribute is set:"
#~ msgstr ""
#~ "Los procedimientos almacenados se encuentran soportados si el atributo "
#~ "<literal>callable está configurado:"

#~ msgid ""
#~ "The order of the positional parameters is vital, as they must be in the "
#~ "same sequence as Hibernate expects them."
#~ msgstr ""
#~ "El orden de los parámetros posicionales es vital ya que se deben "
#~ "encontrar en la misma secuencia en que Hibernate los espera."

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate query_sql.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.