📄 transactions.po
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 07:47+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: transactions.xml:5#, no-c-formatmsgid "Transactions And Concurrency"msgstr "Transacciones y Concurrencia"#. Tag: para#: transactions.xml:7#, no-c-formatmsgid """The most important point about Hibernate and concurrency control is that it ""is very easy to understand. Hibernate directly uses JDBC connections and JTA ""resources without adding any additional locking behavior. We highly ""recommend you spend some time with the JDBC, ANSI, and transaction isolation ""specification of your database management system."msgstr """El punto más importante sobre Hibernate y el control de concurrencia es que ""muy fácil de comprender. Hibernate usa directamente conexiones JDBC y ""recursos JTA sin agregar ningún comportamiento de bloqueo adicional. ""Recomendamos altamente que gastes algo de tiempo con la especificación de ""JDBC, ANSI, y el aislamiento de transacciones de tu sistema de gestión de ""base de datos. Hibernate sólo añade versionado automático pero no bloquea ""objetos en memoria ni cambia el nivel de aislamiento de tus transacciones de ""base de datos. Básicamente, usa Hibernate como usarías JDBC directo (o JTA/""CMT) con tus recursos de base de datos."#. Tag: para#: transactions.xml:14#, no-c-formatmsgid """Hibernate does not lock objects in memory. Your application can expect the ""behavior as defined by the isolation level of your database transactions. ""Note that thanks to the <literal>Session</literal>, which is also a ""transaction-scoped cache, Hibernate provides repeatable reads for lookup by ""identifier and entity queries (not reporting queries that return scalar ""values)."msgstr """Hibernate does not lock objects in memory. Your application can expect the ""behavior as defined by the isolation level of your database transactions. ""Note that thanks to the <literal>Session</literal>, which is also a ""transaction-scoped cache, Hibernate provides repeatable reads for lookup by ""identifier and entity queries (not reporting queries that return scalar ""values)."#. Tag: para#: transactions.xml:22#, no-c-formatmsgid """In addition to versioning for automatic optimistic concurrency control, ""Hibernate also offers a (minor) API for pessimistic locking of rows, using ""the <literal>SELECT FOR UPDATE</literal> syntax. Optimistic concurrency ""control and this API are discussed later in this chapter."msgstr """Sin embargo, además del versionado automático, Hibernate ofrece una API ""(menor) para bloqueo pesimista de filas, usando la sintáxis <literal>SELECT ""FOR UPDATE</literal>. Esta API se discute más adelante en este capítulo:"#. Tag: para#: transactions.xml:29#, no-c-formatmsgid """We start the discussion of concurrency control in Hibernate with the ""granularity of <literal>Configuration</literal>, <literal>SessionFactory</""literal>, and <literal>Session</literal>, as well as database transactions ""and long conversations."msgstr """Comenzamos la discusión del control de concurrencia en Hibernate con la ""granularidad de <literal>Configuration</literal>, <literal>SessionFactory</""literal>, y <literal>Session</literal>, así como la base de datos y las ""transacciones de aplicación largas."#. Tag: title#: transactions.xml:36#, no-c-formatmsgid "Session and transaction scopes"msgstr "Ámbitos de sesión y de transacción"#. Tag: para#: transactions.xml:38#, no-c-formatmsgid """A <literal>SessionFactory</literal> is an expensive-to-create, threadsafe ""object intended to be shared by all application threads. It is created once, ""usually on application startup, from a <literal>Configuration</literal> ""instance."msgstr """Una <literal>SessionFactory</literal> es un objeto seguro entre hebras caro-""de-crear pensado para ser compartido por todas las hebras de la aplicación. ""Es creado una sola vez, usualmente en el arranque de la aplicación, a partir ""de una instancia de <literal>Configuration</literal>."#. Tag: para#: transactions.xml:44#, no-c-formatmsgid """A <literal>Session</literal> is an inexpensive, non-threadsafe object that ""should be used once, for a single request, a conversation, single unit of ""work, and then discarded. A <literal>Session</literal> will not obtain a ""JDBC <literal>Connection</literal> (or a <literal>Datasource</literal>) ""unless it is needed, hence consume no resources until used."msgstr """Una <literal>Session</literal> es un objeto barato, inseguro entre hebras ""que debe ser usado una sola vez, para un solo proceso de negocio, una sola ""unidad de trabajo, y luego descartado. Una <literal>Session</literal> no ""obtendrá una <literal>Connection</literal> JDBC (o un <literal>Datasource</""literal>) a menos que sea necesario, de modo que puedas abrir y cerrar ""seguramente una <literal>Session</literal> incluso si no estás seguro que se ""necesitará acceso a los datos para servir una petición en particular. (Esto ""se vuelve importante en cuanto estés implementando alguno de los siguientes ""patrones usando intercepción de peticiones)."#. Tag: para#: transactions.xml:52#, no-c-formatmsgid """To complete this picture you also have to think about database transactions. ""A database transaction has to be as short as possible, to reduce lock ""contention in the database. Long database transactions will prevent your ""application from scaling to highly concurrent load. Hence, it is almost ""never good design to hold a database transaction open during user think ""time, until the unit of work is complete."msgstr """Para completar este cuadro tienes que pensar también en las transacciones de ""base de datos. Una transacción de base de datos tiene que ser tan corta como ""sea posible, para reducir la contención de bloqueos en la base de datos. Las ""transacciones largas de base de datos prevendrán a tu aplicación de escalar ""a una carga altamente concurrente."#. Tag: para#: transactions.xml:61#, no-c-formatmsgid """What is the scope of a unit of work? Can a single Hibernate ""<literal>Session</literal> span several database transactions or is this a ""one-to-one relationship of scopes? When should you open and close a ""<literal>Session</literal> and how do you demarcate the database transaction ""boundaries?"msgstr """¿Qué es el ámbito de una unidad de trabajo? ¿Puede una sola ""<literal>Session</literal> de Hibernate extenderse a través de varias ""transacciones de base de datos o es ésta una relación uno-a-uno de ámbitos? ""¿Cuándo debes abrir y cerrar una <literal>Session</literal> y cómo demarcas ""los límites de la transacción de base de datos?"#. Tag: title#: transactions.xml:69#, no-c-formatmsgid "Unit of work"msgstr "Unidad de trabajo"#. Tag: para#: transactions.xml:71#, no-c-formatmsgid """First, don't use the <emphasis>session-per-operation</emphasis> antipattern, ""that is, don't open and close a <literal>Session</literal> for every simple ""database call in a single thread! Of course, the same is true for database ""transactions. Database calls in an application are made using a planned ""sequence, they are grouped into atomic units of work. (Note that this also ""means that auto-commit after every single SQL statement is useless in an ""application, this mode is intended for ad-hoc SQL console work. Hibernate ""disables, or expects the application server to do so, auto-commit mode ""immediately.) Database transactions are never optional, all communication ""with a database has to occur inside a transaction, no matter if you read or ""write data. As explained, auto-commit behavior for reading data should be ""avoided, as many small transactions are unlikely to perform better than one ""clearly defined unit of work. The latter is also much more maintainable and ""extensible."msgstr """Primero, no uses el antipatrón <emphasis>sesión-por-operación</emphasis>, ""esto es, ¡no abras y cierres una <literal>Session</literal> para cada simple ""llamada a la base de datos en una sola hebra! Por supuesto, lo mismo es ""verdad para transacciones de base de datos. Las llamadas a base de datos en ""una aplicación se hacen usando una secuencia prevista, que están agrupadas ""dentro de unidades de trabajo atómicas. (Nota que esto también significa que ""el auto-commit después de cada una de las sentencias SQL es inútil en una ""aplicación, este modo está pensado para trabajo ad-hoc de consola SQL. ""Hibernate deshabilita, o espera que el servidor de aplicaciones lo haga, el ""modo auto-commit inmediatamente.)"#. Tag: para#: transactions.xml:87#, no-c-formatmsgid """The most common pattern in a multi-user client/server application is ""<emphasis>session-per-request</emphasis>. In this model, a request from the ""client is send to the server (where the Hibernate persistence layer runs), a ""new Hibernate <literal>Session</literal> is opened, and all database ""operations are executed in this unit of work. Once the work has been ""completed (and the response for the client has been prepared), the session ""is flushed and closed. You would also use a single database transaction to ""serve the clients request, starting and committing it when you open and ""close the <literal>Session</literal>. The relationship between the two is ""one-to-one and this model is a perfect fit for many applications."msgstr """El patrón más común en una aplicación mutiusuario cliente/servidor es ""<emphasis>sesión-por-petición</emphasis>. En este modelo, una petición del ""cliente es enviada al servidor (en donde se ejecuta la capa de persistencia ""de Hibernate), se abre una nueva <literal>Session</literal> de Hibernate, y ""todas las operaciones de base de datos se ejecutan en esta unidad de ""trabajo. Una vez completado el trabajo (y se ha preparado la respuesta para ""el cliente) la sesión es limpiada y cerrada. Podrías usar una sola ""transacción de base de datos para servir a petición del cliente, ""comenzándola y comprometiéndola cuando abres y cierras la <literal>Session</""literal>. La relación entre las dos es uno-a-uno y este modelo es a la ""medida perfecta de muchas aplicaciones."#. Tag: para#: transactions.xml:99#, no-c-formatmsgid """The challenge lies in the implementation. Hibernate provides built-in ""management of the \"current session\" to simplify this pattern. All you have ""to do is start a transaction when a server request has to be processed, and ""end the transaction before the response is send to the client. You can do ""this in any way you like, common solutions are <literal>ServletFilter</""literal>, AOP interceptor with a pointcut on the service methods, or a proxy/""interception container. An EJB container is a standardized way to implement ""cross-cutting aspects such as transaction demarcation on EJB session beans, ""declaratively with CMT. If you decide to use programmatic transaction ""demarcation, prefer the Hibernate <literal>Transaction</literal> API shown ""later in this chapter, for ease of use and code portability."msgstr """The challenge lies in the implementation. Hibernate provides built-in ""management of the \"current session\" to simplify this pattern. All you have ""to do is start a transaction when a server request has to be processed, and ""end the transaction before the response is send to the client. You can do ""this in any way you like, common solutions are <literal>ServletFilter</""literal>, AOP interceptor with a pointcut on the service methods, or a proxy/""interception container. An EJB container is a standardized way to implement ""cross-cutting aspects such as transaction demarcation on EJB session beans, ""declaratively with CMT. If you decide to use programmatic transaction ""demarcation, prefer the Hibernate <literal>Transaction</literal> API shown ""later in this chapter, for ease of use and code portability."#. Tag: para#: transactions.xml:112#, no-c-formatmsgid """Your application code can access a \"current session\" to process the ""request by simply calling <literal>sessionFactory.getCurrentSession()</""literal> anywhere and as often as needed. You will always get a ""<literal>Session</literal> scoped to the current database transaction. This ""has to be configured for either resource-local or JTA environments, see ""<xref linkend=\"architecture-current-session\"/>."msgstr """Your application code can access a \"current session\" to process the ""request by simply calling <literal>sessionFactory.getCurrentSession()</""literal> anywhere and as often as needed. You will always get a ""<literal>Session</literal> scoped to the current database transaction. This ""has to be configured for either resource-local or JTA environments, see ""<xref linkend=\"architecture-current-session\"/>."#. Tag: para#: transactions.xml:120#, no-c-formatmsgid """Sometimes it is convenient to extend the scope of a <literal>Session</""literal> and database transaction until the \"view has been rendered\". This ""is especially useful in servlet applications that utilize a separate ""rendering phase after the request has been processed. Extending the database ""transaction until view rendering is complete is easy to do if you implement ""your own interceptor. However, it is not easily doable if you rely on EJBs ""with container-managed transactions, as a transaction will be completed when ""an EJB method returns, before rendering of any view can start. See the ""Hibernate website and forum for tips and examples around this <emphasis>Open ""Session in View</emphasis> pattern."msgstr """Sometimes it is convenient to extend the scope of a <literal>Session</"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -