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

📄 session_api.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 5 页
字号:
#: index.docbook:168msgid """Note that <literal>load()</literal> will throw an unrecoverable exception if ""there is no matching database row. If the class is mapped with a proxy, ""<literal>load()</literal> just returns an uninitialized proxy and does not ""actually hit the database until you invoke a method of the proxy. This ""behaviour is very 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</literal> is ""defined for the class mapping."msgstr """Nota que <literal>load()</literal> lanzar&#x00e1; una excepci&#x00f3;n ""irrecuperable si no hay una fila correspondiente en base de datos. Si la ""clase es mapeada con un proxy, <literal>load()</literal> s&#x00f3;lo ""devuelve un proxy no inicializado y no llamar&#x00e1; realmente a la base de ""datos hasta que invoques un m&#x00e9;todo del proxy. Este comportamiento es ""muy &#x00fa;til si deseas crear una asociaci&#x00f3;n a un objeto sin ""cargarlo realmente de la base de datos. Permite adem&#x00e1;s que m&#x00fa;""ltiples instancias sean cargadas como un lote si se define <literal>batch-""size</literal> para el mapeo de la clase."#: index.docbook:179msgid """If you are not certain that a matching row exists, you should use the ""<literal>get()</literal> method, which hits the database immediately and ""returns null if there is no matching row."msgstr """Si no tienes certeza que exista una fila correspondiente, debes usar el ""m&#x00e9;todo <literal>get()</literal>, que llama a la base de datos ""inmediatamente y devuelve nulo si no existe una fila correspondiente."#: index.docbook:185msgid """<![CDATA[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 """<![CDATA[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;]]>"#: index.docbook:187msgid """You may even load an object using an SQL <literal>SELECT ... FOR UPDATE</""literal>, using a <literal>LockMode</literal>. See the API documentation for ""more information."msgstr """Puedes incluso cargar un objeto usando un <literal>SELECT ... FOR UPDATE</""literal> de SQL, usando un <literal>LockMode</literal>. Ver la ""documentaci&#x00f3;n de la API para m&#x00e1;s informaci&#x00f3;n."#: index.docbook:192msgid "<![CDATA[Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);]]>"msgstr "<![CDATA[Cat cat = (Cat) sess.get(Cat.class, id, LockMode.UPGRADE);]]>"#: index.docbook:194msgid """Note that any associated instances or contained collections are ""<emphasis>not</emphasis> selected <literal>FOR UPDATE</literal>, unless you ""decide to specify <literal>lock</literal> or <literal>all</literal> as a ""cascade style for the association."msgstr """Ten en cuenta que <emphasis>ninguna</emphasis> instancia asociada o ""colecci&#x00f3;n contenida es selecciona <literal>FOR UPDATE</literal>, a ""menos que decidas especificar <literal>lock</literal> o <literal>all</""literal> como un estilo de cascada para la asociaci&#x00f3;n."#: index.docbook:201msgid """It is possible to re-load an object and all its collections at any time, ""using the <literal>refresh()</literal> 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, usando el m&#x00e9;todo <literal>refresh()</literal>. Esto es ""&#x00fa;til cuando se usan disparadores de base de datos para inicializar ""algunas de las propiedades del objeto."#: index.docbook:207msgid """<![CDATA[sess.save(cat);\n""sess.flush(); //force the SQL INSERT\n""sess.refresh(cat); //re-read the state (after the trigger executes)]]>"msgstr """<![CDATA[sess.save(cat);\n""sess.flush(); //force the SQL INSERT\n""sess.refresh(cat); //re-read the state (after the trigger executes)]]>"#: index.docbook:209msgid """An important question usually appears at this point: How much does Hibernate ""load from the database and how many SQL <literal>SELECT</literal>s will it ""use? This depends on the <emphasis>fetching strategy</emphasis> and is ""explained in <xref linkend=\"performance-fetching\"/>."msgstr """Una cuesti&#x00f3;n importante aparece usualmente en este punto: ¿Cu&#x00e1;""nto carga Hibernate de la base de datos y cu&#x00e1;ntos <literal>SELECT</""literal>s de SQL usar&#x00e1;? Esto depende de la <emphasis>estrategia de ""recuperaci&#x00f3;n</emphasis> y se explica en <xref linkend=\"performance-""fetching\"/>."#: index.docbook:219msgid "Querying"msgstr "Consultando"#: index.docbook:221msgid """If you don't know the identifiers of the objects you are looking for, you ""need a query. Hibernate supports an easy-to-use but powerful object oriented ""query language (HQL). For programmatic query creation, Hibernate supports a ""sophisticated Criteria and Example query feature (QBC and QBE). You may also ""express your query in the native SQL of your database, with optional support ""from Hibernate for result set conversion into objects."msgstr """Si no sabes los identificadores de los objetos que est&#x00e1;s buscando, ""necesitas una consulta. Hibernate soporta un lenguaje de consulta orientado ""a objetos (HQL) f&#x00e1;cil de usar pero potente. Para la creaci&#x00f3;n ""de consultas program&#x00e1;ticas, Hibernate soporta una funcionalidad ""sofisticada de consulta de Criteria y Example (QBC and QBE). Tambi&#x00e9;n ""puedes expresar tu consulta en el SQL nativo de tu base de datos, con ""soporte opcional de Hibernate para la conversi&#x00f3;n del conjunto ""resultado en objetos."#: index.docbook:231msgid "Executing queries"msgstr "Ejecutando consultas"#: index.docbook:233msgid """HQL and native SQL queries are represented with an instance of <literal>org.""hibernate.Query</literal>. This interface offers methods for parameter ""binding, result set handling, and for the execution of the actual query. You ""always obtain a <literal>Query</literal> using the current <literal>Session</""literal>:"msgstr """Las consultas HQL y SQL nativas son representadas con una instancia de ""<literal>org.hibernate.Query</literal>. Esta interface ofrece m&#x00e9;todos ""para la ligaci&#x00f3;n de par&#x00e1;metros, manejo del conjunto resultado, ""y para la ejecuci&#x00f3;n de la consulta real. Siempre obtienes una ""<literal>Query</literal> usando la <literal>Session</literal> actual:"#: index.docbook:240msgid """<![CDATA[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 """<![CDATA[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();]]>"#: index.docbook:242msgid """A query is usually executed by invoking <literal>list()</literal>, the ""result of the query will be loaded completely into a collection in memory. ""Entity instances retrieved by a query are in persistent state. The ""<literal>uniqueResult()</literal> method offers a shortcut if you know your ""query will only return a single object. Note that 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 ""simply through a <literal>Set</literal>."msgstr """Una consulta se ejecuta usualmente invocando a <literal>list()</literal>, el ""resultado de la consulta ser&#x00e1; cargado completamente dentro de una ""colecci&#x00f3;n en memoria. Las instancias de entidad tra&#x00ed;das por ""una consulta est&#x00e1;n en estado persistente. El m&#x00e9;todo ""<literal>uniqueResult()</literal> ofrece un atajo si sabes que tu consulta ""devolver&#x00e1; s&#x00f3;lo un objeto."#: index.docbook:254msgid "Iterating results"msgstr "Iterando los resultados"#: index.docbook:256msgid """Occasionally, you might be able to achieve better performance by executing ""the query using the <literal>iterate()</literal> method. This will only ""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()</literal> will be slower than ""<literal>list()</literal> and might require many database hits for a simple ""query, usually <emphasis>1</emphasis> for the initial select which only ""returns identifiers, and <emphasis>n</emphasis> additional selects to ""initialize the actual instances."msgstr """Ocasionalmente, podr&#x00ed;as ser capaz de lograr mejor rendimiento al ""ejecutar la consulta usando el m&#x00e9;todo <literal>iterate()</literal>. ""Esto s&#x00f3;lo ser&#x00e1; en el caso que esperes que las instancias ""reales de entidad devueltas por la consulta est&#x00e9;n ya en la ""sesi&#x00f3;n o cach&#x00e9; de segundo nivel. Si todav&#x00ed;a no ""est&#x00e1;n en cach&#x00e9;, <literal>iterate()</literal> ser&#x00e1; ""m&#x00e1;s lento que <literal>list()</literal> y podr&#x00ed;a requerir ""muchas llamadas a la base de datos para una consulta simple, usualmente ""<emphasis>1</emphasis> para la selecci&#x00f3;n inicial que solamente ""devuelve identificadores, y <emphasis>n</emphasis> selecciones adicionales ""para inicializar las instancias reales."#: index.docbook:268msgid """<![CDATA[// 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 """<![CDATA[// 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""}]]>"#: index.docbook:272msgid "Queries that return tuples"msgstr "Consultas que devuelven tuplas"#: index.docbook:274msgid """Hibernate queries sometimes return tuples of objects, in which case each ""tuple is returned as an array:"msgstr """Las consultas de Hibernate a veces devuelven tuplas de objetos, en cuyo caso ""cada tupla se devuelve como un array:"#: index.docbook:279msgid """<![CDATA[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 """<![CDATA[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""}]]>"#: index.docbook:284msgid "Scalar results"msgstr "Resultados escalares"

⌨️ 快捷键说明

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