Convert from pt-BR XML and merge with latest English XML
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14135 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
51efece885
commit
c7bc162118
|
@ -1,216 +1,644 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:21
|
||||
"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
|
||||
#: architecture.xml:21
|
||||
#, no-c-format
|
||||
msgid "Architecture"
|
||||
msgstr "Arquitetura"
|
||||
|
||||
#: index.docbook:24
|
||||
#. Tag: title
|
||||
#: architecture.xml:24
|
||||
#, no-c-format
|
||||
msgid "Overview"
|
||||
msgstr "Visão Geral"
|
||||
msgstr "Visão Geral"
|
||||
|
||||
#: index.docbook:26
|
||||
#. Tag: para
|
||||
#: architecture.xml:26
|
||||
#, no-c-format
|
||||
msgid "A (very) high-level view of the Hibernate architecture:"
|
||||
msgstr "Uma visão bem ampla da arquitetura do Hibernate:"
|
||||
msgstr "Uma visão bem ampla da arquitetura do Hibernate:"
|
||||
|
||||
#: index.docbook:39
|
||||
msgid "This diagram shows Hibernate using the database and configuration data to provide persistence services (and persistent objects) to the application."
|
||||
msgstr "Esse diagrama mostra o Hibernate usando o banco de dados e a configuração de dados para prover persistência de serviços (e persistência de objetos) para o aplicativo."
|
||||
#. Tag: para
|
||||
#: architecture.xml:39
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This diagram shows Hibernate using the database and configuration data to "
|
||||
"provide persistence services (and persistent objects) to the application."
|
||||
msgstr ""
|
||||
"Esse diagrama mostra o Hibernate usando o banco de dados e a configuração de "
|
||||
"dados para prover persistência de serviços (e persistência de objetos) para "
|
||||
"o aplicativo."
|
||||
|
||||
#: index.docbook:44
|
||||
msgid "We would like to show a more detailed view of the runtime architecture. Unfortunately, Hibernate is flexible and supports several approaches. We will show the two extremes. The \"lite\" architecture has the application provide its own JDBC connections and manage its own transactions. This approach uses a minimal subset of Hibernate's APIs:"
|
||||
msgstr "Nós gostaríamos de mostrar uma visão mais detalhada da arquitetura em execução. Infelizmente, o Hibernate é muito flexível e suporta várias aproximações. Nós iremos mostrar os dois extremos. Na arquitetura mais simples o aplicativo fornece suas próprias conexões JDBC e gerencia suas transações. Esta abordagem usa o mínimo de subconjuntos das APIs do Hibernate:"
|
||||
#. Tag: para
|
||||
#: architecture.xml:44
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"We would like to show a more detailed view of the runtime architecture. "
|
||||
"Unfortunately, Hibernate is flexible and supports several approaches. We "
|
||||
"will show the two extremes. The \"lite\" architecture has the application "
|
||||
"provide its own JDBC connections and manage its own transactions. This "
|
||||
"approach uses a minimal subset of Hibernate's APIs:"
|
||||
msgstr ""
|
||||
"Nós gostaríamos de mostrar uma visão mais detalhada da arquitetura em "
|
||||
"execução. Infelizmente, o Hibernate é muito flexível e suporta várias "
|
||||
"aproximações. Nós iremos mostrar os dois extremos. Na arquitetura mais "
|
||||
"simples o aplicativo fornece suas próprias conexões JDBC e gerencia suas "
|
||||
"transações. Esta abordagem usa o mínimo de subconjuntos das APIs do "
|
||||
"Hibernate:"
|
||||
|
||||
#: index.docbook:61
|
||||
msgid "The \"full cream\" architecture abstracts the application away from the underlying JDBC/JTA APIs and lets Hibernate take care of the details."
|
||||
msgstr "A arquitetura \"completa\" abstrai a aplicação de ter de lidar diretamente com JDBC/JTA e APIs e deixa o Hibernate tomar conta dos detalhes."
|
||||
#. Tag: para
|
||||
#: architecture.xml:61
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The \"full cream\" architecture abstracts the application away from the "
|
||||
"underlying JDBC/JTA APIs and lets Hibernate take care of the details."
|
||||
msgstr ""
|
||||
"A arquitetura \"completa\" abstrai a aplicação de ter de lidar diretamente "
|
||||
"com JDBC/JTA e APIs e deixa o Hibernate tomar conta dos detalhes."
|
||||
|
||||
#: index.docbook:75
|
||||
#. Tag: para
|
||||
#: architecture.xml:75
|
||||
#, fuzzy, no-c-format
|
||||
msgid "Heres some definitions of the objects in the diagrams:"
|
||||
msgstr "Algumas definições dos objetos do diagrama:"
|
||||
msgstr "Algumas definições dos objetos do diagrama: <placeholder-1/>"
|
||||
|
||||
#: index.docbook:80
|
||||
#. Tag: term
|
||||
#: architecture.xml:80
|
||||
#, no-c-format
|
||||
msgid "SessionFactory (<literal>org.hibernate.SessionFactory</literal>)"
|
||||
msgstr "SessionFactory (<literal>org.hibernate.SessionFactory</literal>)"
|
||||
|
||||
#: index.docbook:82
|
||||
msgid "A threadsafe (immutable) cache of compiled mappings for a single database. A factory for <literal>Session</literal> and a client of <literal>ConnectionProvider</literal>. Might hold an optional (second-level) cache of data that is reusable between transactions, at a process- or cluster-level."
|
||||
msgstr "Um cache threadsafe (imutáveis) composto de identidades compiladas para um único banco de dados. Uma fabrica para <literal>Session</literal> e um cliente de <literal>ConnectionProvider</literal>. Pode conter um cachê opcional de dados (segundo nível) reutilizáveis entre transações, no nível de processo- ou cluster."
|
||||
#. Tag: para
|
||||
#: architecture.xml:82
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A threadsafe (immutable) cache of compiled mappings for a single database. A "
|
||||
"factory for <literal>Session</literal> and a client of "
|
||||
"<literal>ConnectionProvider</literal>. Might hold an optional (second-level) "
|
||||
"cache of data that is reusable between transactions, at a process- or "
|
||||
"cluster-level."
|
||||
msgstr ""
|
||||
"Um cache threadsafe (imutáveis) composto de identidades compiladas para um "
|
||||
"único banco de dados. Uma fabrica para <literal>Session</literal> e um "
|
||||
"cliente de <literal>ConnectionProvider</literal>. Pode conter um cachê "
|
||||
"opcional de dados (segundo nível) reutilizáveis entre transações, no nível "
|
||||
"de processo- ou cluster."
|
||||
|
||||
#: index.docbook:92
|
||||
#. Tag: term
|
||||
#: architecture.xml:92
|
||||
#, no-c-format
|
||||
msgid "Session (<literal>org.hibernate.Session</literal>)"
|
||||
msgstr "Session (<literal>org.hibernate.Session</literal>)"
|
||||
|
||||
#: index.docbook:94
|
||||
msgid "A single-threaded, short-lived object representing a conversation between the application and the persistent store. Wraps a JDBC connection. Factory for <literal>Transaction</literal>. Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier."
|
||||
msgstr "Objeto single-threaded, de vida curta, representando uma conversação entre o aplicativo e o armazenamento persistente. Cria uma camada sobre uma conexão JDBC. É uma fabrica de <literal>Transaction</literal>. Possui um cachê obrigatório (primeiro nível) de objetos persistentes, usado para navegação no gráficos de objetos e pesquisa de objetos pelo identificador."
|
||||
#. Tag: para
|
||||
#: architecture.xml:94
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A single-threaded, short-lived object representing a conversation between "
|
||||
"the application and the persistent store. Wraps a JDBC connection. Factory "
|
||||
"for <literal>Transaction</literal>. Holds a mandatory (first-level) cache of "
|
||||
"persistent objects, used when navigating the object graph or looking up "
|
||||
"objects by identifier."
|
||||
msgstr ""
|
||||
"Objeto single-threaded, de vida curta, representando uma conversação entre o "
|
||||
"aplicativo e o armazenamento persistente. Cria uma camada sobre uma conexão "
|
||||
"JDBC. É uma fabrica de <literal>Transaction</literal>. Possui um cachê "
|
||||
"obrigatório (primeiro nível) de objetos persistentes, usado para navegação "
|
||||
"no gráficos de objetos e pesquisa de objetos pelo identificador."
|
||||
|
||||
#: index.docbook:104
|
||||
#. Tag: term
|
||||
#: architecture.xml:104
|
||||
#, no-c-format
|
||||
msgid "Persistent objects and collections"
|
||||
msgstr "Objetos persistentes e coleções"
|
||||
|
||||
#: index.docbook:106
|
||||
msgid "Short-lived, single threaded objects containing persistent state and business function. These might be ordinary JavaBeans/POJOs, the only special thing about them is that they are currently associated with (exactly one) <literal>Session</literal>. As soon as the <literal>Session</literal> is closed, they will be detached and free to use in any application layer (e.g. directly as data transfer objects to and from presentation)."
|
||||
msgstr "Objetos, de vida curta, single threaded contendo estado persistente e função de negócios. Esses podem ser JavaBeans/POJOs, onde única coisa especial sobre eles é que são associados a (exatamente uma) <literal>Session</literal>. Quando a <literal>Session</literal> é fechada, eles são separados e liberados para serem usados dentro de qualquer camada da aplicacao (Ex. diretamente como data transfer objects de e para a camada de apresentação)"
|
||||
#. Tag: para
|
||||
#: architecture.xml:106
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Short-lived, single threaded objects containing persistent state and "
|
||||
"business function. These might be ordinary JavaBeans/POJOs, the only special "
|
||||
"thing about them is that they are currently associated with (exactly one) "
|
||||
"<literal>Session</literal>. As soon as the <literal>Session</literal> is "
|
||||
"closed, they will be detached and free to use in any application layer (e.g. "
|
||||
"directly as data transfer objects to and from presentation)."
|
||||
msgstr ""
|
||||
"Objetos, de vida curta, single threaded contendo estado persistente e função "
|
||||
"de negócios. Esses podem ser JavaBeans/POJOs, onde única coisa especial "
|
||||
"sobre eles é que são associados a (exatamente uma) <literal>Session</"
|
||||
"literal>. Quando a <literal>Session</literal> é fechada, eles são separados "
|
||||
"e liberados para serem usados dentro de qualquer camada da aplicacao (Ex. "
|
||||
"diretamente como data transfer objects de e para a camada de apresentação)"
|
||||
|
||||
#: index.docbook:117
|
||||
#. Tag: term
|
||||
#: architecture.xml:117
|
||||
#, no-c-format
|
||||
msgid "Transient and detached objects and collections"
|
||||
msgstr "Objetos e coleções desatachados e transientes"
|
||||
|
||||
#: index.docbook:119
|
||||
msgid "Instances of persistent classes that are not currently associated with a <literal>Session</literal>. They may have been instantiated by the application and not (yet) persisted or they may have been instantiated by a closed <literal>Session</literal>."
|
||||
msgstr "Instâncias de classes persistentes que ainda não estão associadas a uma <literal>Session</literal>. Eles podem ter sido instanciados pela aplicação e não persistido (ainda) ou eles foram instanciados por uma <literal>Session</literal> que foi encerrada."
|
||||
#. Tag: para
|
||||
#: architecture.xml:119
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Instances of persistent classes that are not currently associated with a "
|
||||
"<literal>Session</literal>. They may have been instantiated by the "
|
||||
"application and not (yet) persisted or they may have been instantiated by a "
|
||||
"closed <literal>Session</literal>."
|
||||
msgstr ""
|
||||
"Instâncias de classes persistentes que ainda não estão associadas a uma "
|
||||
"<literal>Session</literal>. Eles podem ter sido instanciados pela aplicação "
|
||||
"e não persistido (ainda) ou eles foram instanciados por uma "
|
||||
"<literal>Session</literal> que foi encerrada."
|
||||
|
||||
#: index.docbook:128
|
||||
#. Tag: term
|
||||
#: architecture.xml:128
|
||||
#, no-c-format
|
||||
msgid "Transaction (<literal>org.hibernate.Transaction</literal>)"
|
||||
msgstr "Transaction (<literal>org.hibernate.Transaction</literal>)"
|
||||
|
||||
#: index.docbook:130
|
||||
msgid "(Optional) A single-threaded, short-lived object used by the application to specify atomic units of work. Abstracts application from underlying JDBC, JTA or CORBA transaction. A <literal>Session</literal> might span several <literal>Transaction</literal>s in some cases. However, transaction demarcation, either using the underlying API or <literal>Transaction</literal>, is never optional!"
|
||||
msgstr "(Opcional) Objeto de vida curta, single threaded, usado pela aplicação para especificar unidades atômicas de trabalho. Abstrai o aplicativo de lidar diretamente com transações JDBC, JTA ou CORBA. Uma <literal>Session</literal> pode, em alguns casos, iniciar várias <literal>Transaction</literal>s. Entretanto, a demarcação da transação, mesmo utilizando API ou Transaction subjacentes, nunca é opcional!"
|
||||
#. Tag: para
|
||||
#: architecture.xml:130
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"(Optional) A single-threaded, short-lived object used by the application to "
|
||||
"specify atomic units of work. Abstracts application from underlying JDBC, "
|
||||
"JTA or CORBA transaction. A <literal>Session</literal> might span several "
|
||||
"<literal>Transaction</literal>s in some cases. However, transaction "
|
||||
"demarcation, either using the underlying API or <literal>Transaction</"
|
||||
"literal>, is never optional!"
|
||||
msgstr ""
|
||||
"(Opcional) Objeto de vida curta, single threaded, usado pela aplicação para "
|
||||
"especificar unidades atômicas de trabalho. Abstrai o aplicativo de lidar "
|
||||
"diretamente com transações JDBC, JTA ou CORBA. Uma <literal>Session</"
|
||||
"literal> pode, em alguns casos, iniciar várias <literal>Transaction</"
|
||||
"literal>s. Entretanto, a demarcação da transação, mesmo utilizando API ou "
|
||||
"Transaction subjacentes, nunca é opcional!"
|
||||
|
||||
#: index.docbook:141
|
||||
msgid "ConnectionProvider (<literal>org.hibernate.connection.ConnectionProvider</literal>)"
|
||||
msgstr "ConnectionProvider (<literal>org.hibernate.connection.ConnectionProvider</literal>)"
|
||||
#. Tag: term
|
||||
#: architecture.xml:141
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"ConnectionProvider (<literal>org.hibernate.connection.ConnectionProvider</"
|
||||
"literal>)"
|
||||
msgstr ""
|
||||
"ConnectionProvider (<literal>org.hibernate.connection.ConnectionProvider</"
|
||||
"literal>)"
|
||||
|
||||
#: index.docbook:143
|
||||
msgid "(Optional) A factory for (and pool of) JDBC connections. Abstracts application from underlying <literal>Datasource</literal> or <literal>DriverManager</literal>. Not exposed to application, but can be extended/implemented by the developer."
|
||||
msgstr "(Opcional) Uma fábrica de (e combinações de) conexões JDBC. Abstrai a aplicação de lidar diretamente com <literal>Datasource</literal> ou <literal>DriverManager</literal>. Não exposto para a aplicação, mas pode ser implementado ou estendido pelo programador."
|
||||
#. Tag: para
|
||||
#: architecture.xml:143
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"(Optional) A factory for (and pool of) JDBC connections. Abstracts "
|
||||
"application from underlying <literal>Datasource</literal> or "
|
||||
"<literal>DriverManager</literal>. Not exposed to application, but can be "
|
||||
"extended/implemented by the developer."
|
||||
msgstr ""
|
||||
"(Opcional) Uma fábrica de (e combinações de) conexões JDBC. Abstrai a "
|
||||
"aplicação de lidar diretamente com <literal>Datasource</literal> ou "
|
||||
"<literal>DriverManager</literal>. Não exposto para a aplicação, mas pode ser "
|
||||
"implementado ou estendido pelo programador."
|
||||
|
||||
#: index.docbook:151
|
||||
msgid "TransactionFactory (<literal>org.hibernate.TransactionFactory</literal>)"
|
||||
msgstr "TransactionFactory (<literal>org.hibernate.TransactionFactory</literal>)"
|
||||
#. Tag: term
|
||||
#: architecture.xml:151
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"TransactionFactory (<literal>org.hibernate.TransactionFactory</literal>)"
|
||||
msgstr ""
|
||||
"TransactionFactory (<literal>org.hibernate.TransactionFactory</literal>)"
|
||||
|
||||
#: index.docbook:153
|
||||
msgid "(Optional) A factory for <literal>Transaction</literal> instances. Not exposed to the application, but can be extended/implemented by the developer."
|
||||
msgstr "(Opcional) Uma fábrica para instâncias de <literal>Transaction</literal>. Não exposta a aplicação, mas pode ser extendida/implementada pelo programador."
|
||||
#. Tag: para
|
||||
#: architecture.xml:153
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"(Optional) A factory for <literal>Transaction</literal> instances. Not "
|
||||
"exposed to the application, but can be extended/implemented by the developer."
|
||||
msgstr ""
|
||||
"(Opcional) Uma fábrica para instâncias de <literal>Transaction</literal>. "
|
||||
"Não exposta a aplicação, mas pode ser extendida/implementada pelo "
|
||||
"programador."
|
||||
|
||||
#: index.docbook:160
|
||||
#. Tag: emphasis
|
||||
#: architecture.xml:160
|
||||
#, no-c-format
|
||||
msgid "Extension Interfaces"
|
||||
msgstr "Extension Interfaces"
|
||||
|
||||
#: index.docbook:162
|
||||
msgid "Hibernate offers many optional extension interfaces you can implement to customize the behavior of your persistence layer. See the API documentation for details."
|
||||
msgstr "O Hibernate oferece várias opções de interfaces estendidas que você pode implementar para customizar sua camada persistente. Veja a documentação da API para maiores detalhes."
|
||||
#. Tag: para
|
||||
#: architecture.xml:162
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate offers many optional extension interfaces you can implement to "
|
||||
"customize the behavior of your persistence layer. See the API documentation "
|
||||
"for details."
|
||||
msgstr ""
|
||||
"O Hibernate oferece várias opções de interfaces estendidas que você pode "
|
||||
"implementar para customizar sua camada persistente. Veja a documentação da "
|
||||
"API para maiores detalhes."
|
||||
|
||||
#: index.docbook:171
|
||||
msgid "Given a \"lite\" architecture, the application bypasses the <literal>Transaction</literal>/<literal>TransactionFactory</literal> and/or <literal>ConnectionProvider</literal> APIs to talk to JTA or JDBC directly."
|
||||
msgstr "Dada uma arquitetura simples, o aplicativo passa pelas APIs <literal>Transaction</literal>/<literal>TransactionFactory</literal> e/ou <literal>ConnectionProvider</literal> para se comunicar diretamente com a transação JTA ou JDBC."
|
||||
#. Tag: para
|
||||
#: architecture.xml:171
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Given a \"lite\" architecture, the application bypasses the "
|
||||
"<literal>Transaction</literal>/<literal>TransactionFactory</literal> and/or "
|
||||
"<literal>ConnectionProvider</literal> APIs to talk to JTA or JDBC directly."
|
||||
msgstr ""
|
||||
"Dada uma arquitetura simples, o aplicativo passa pelas APIs "
|
||||
"<literal>Transaction</literal>/<literal>TransactionFactory</literal> e/ou "
|
||||
"<literal>ConnectionProvider</literal> para se comunicar diretamente com a "
|
||||
"transação JTA ou JDBC."
|
||||
|
||||
#: index.docbook:179
|
||||
#. Tag: title
|
||||
#: architecture.xml:179
|
||||
#, no-c-format
|
||||
msgid "Instance states"
|
||||
msgstr "Estados de instância"
|
||||
|
||||
#: index.docbook:180
|
||||
msgid "An instance of a persistent classes may be in one of three different states, which are defined with respect to a <emphasis>persistence context</emphasis>. The Hibernate <literal>Session</literal> object is the persistence context:"
|
||||
msgstr "Uma instância de classes persistentes pode estar em um dos três diferentes estados, que são definidos respeitando um <emphasis>contexto persistente</emphasis>. O objeto <literal>Session</literal> do Hibernate é o contexto persistente:"
|
||||
#. Tag: para
|
||||
#: architecture.xml:180
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"An instance of a persistent classes may be in one of three different states, "
|
||||
"which are defined with respect to a <emphasis>persistence context</"
|
||||
"emphasis>. The Hibernate <literal>Session</literal> object is the "
|
||||
"persistence context:"
|
||||
msgstr ""
|
||||
"Uma instância de classes persistentes pode estar em um dos três diferentes "
|
||||
"estados, que são definidos respeitando um <emphasis>contexto persistente</"
|
||||
"emphasis>. O objeto <literal>Session</literal> do Hibernate é o contexto "
|
||||
"persistente:"
|
||||
|
||||
#: index.docbook:188
|
||||
#. Tag: term
|
||||
#: architecture.xml:188
|
||||
#, no-c-format
|
||||
msgid "transient"
|
||||
msgstr "transiente"
|
||||
|
||||
#: index.docbook:190
|
||||
msgid "The instance is not, and has never been associated with any persistence context. It has no persistent identity (primary key value)."
|
||||
msgstr "A instância não é, e nunca foi associada com nenhum contexto persistente. Não possui uma identidade persistente (valor de chave primária)."
|
||||
#. Tag: para
|
||||
#: architecture.xml:190
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The instance is not, and has never been associated with any persistence "
|
||||
"context. It has no persistent identity (primary key value)."
|
||||
msgstr ""
|
||||
"A instância não é, e nunca foi associada com nenhum contexto persistente. "
|
||||
"Não possui uma identidade persistente (valor de chave primária)."
|
||||
|
||||
#: index.docbook:198
|
||||
#. Tag: term
|
||||
#: architecture.xml:198
|
||||
#, no-c-format
|
||||
msgid "persistent"
|
||||
msgstr "persistente"
|
||||
|
||||
#: index.docbook:200
|
||||
msgid "The instance is currently associated with a persistence context. It has a persistent identity (primary key value) and, perhaps, a corresponding row in the database. For a particular persistence context, Hibernate <emphasis>guarantees</emphasis> that persistent identity is equivalent to Java identity (in-memory location of the object)."
|
||||
msgstr "A instância está atualmente associada a um contexto persistente. Possui uma identidade persistente (valor de chave primária) e, talvez, correspondente a um registro no banco de dados. Para um contexto persistente em particular, o Hibernate <emphasis>guarantees</emphasis> que a identidade persistente é equivalente a identidade Java (na localização em memória do objeto)."
|
||||
#. Tag: para
|
||||
#: architecture.xml:200
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The instance is currently associated with a persistence context. It has a "
|
||||
"persistent identity (primary key value) and, perhaps, a corresponding row in "
|
||||
"the database. For a particular persistence context, Hibernate "
|
||||
"<emphasis>guarantees</emphasis> that persistent identity is equivalent to "
|
||||
"Java identity (in-memory location of the object)."
|
||||
msgstr ""
|
||||
"A instância está atualmente associada a um contexto persistente. Possui uma "
|
||||
"identidade persistente (valor de chave primária) e, talvez, correspondente a "
|
||||
"um registro no banco de dados. Para um contexto persistente em particular, o "
|
||||
"Hibernate <emphasis>guarantees</emphasis> que a identidade persistente é "
|
||||
"equivalente a identidade Java (na localização em memória do objeto)."
|
||||
|
||||
#: index.docbook:212
|
||||
#. Tag: term
|
||||
#: architecture.xml:212
|
||||
#, no-c-format
|
||||
msgid "detached"
|
||||
msgstr "desatachado"
|
||||
|
||||
#: index.docbook:214
|
||||
msgid "The instance was once associated with a persistence context, but that context was closed, or the instance was serialized to another process. It has a persistent identity and, perhaps, a corrsponding row in the database. For detached instances, Hibernate makes no guarantees about the relationship between persistent identity and Java identity."
|
||||
msgstr "A instância foi associada com um contexto persistente, porém este contexto foi fechado, ou a instância foi serializada por outro processo. Possui uma identidade persistente, e, talvez, correspondenta a um registro no banco de dados. Para instâncias desatachadas, o Hibernate não garante o relacionamento entre identidade persistente e identidade Java."
|
||||
#. Tag: para
|
||||
#: architecture.xml:214
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The instance was once associated with a persistence context, but that "
|
||||
"context was closed, or the instance was serialized to another process. It "
|
||||
"has a persistent identity and, perhaps, a corrsponding row in the database. "
|
||||
"For detached instances, Hibernate makes no guarantees about the relationship "
|
||||
"between persistent identity and Java identity."
|
||||
msgstr ""
|
||||
"A instância foi associada com um contexto persistente, porém este contexto "
|
||||
"foi fechado, ou a instância foi serializada por outro processo. Possui uma "
|
||||
"identidade persistente, e, talvez, correspondenta a um registro no banco de "
|
||||
"dados. Para instâncias desatachadas, o Hibernate não garante o "
|
||||
"relacionamento entre identidade persistente e identidade Java."
|
||||
|
||||
#: index.docbook:229
|
||||
#. Tag: title
|
||||
#: architecture.xml:229
|
||||
#, no-c-format
|
||||
msgid "JMX Integration"
|
||||
msgstr "Integração JMX"
|
||||
|
||||
#: index.docbook:231
|
||||
msgid "JMX is the J2EE standard for management of Java components. Hibernate may be managed via a JMX standard service. We provide an MBean implementation in the distribution, <literal>org.hibernate.jmx.HibernateService</literal>."
|
||||
msgstr "JMX é padrão J2EE para manipulação de componentes Java. O Hibernate pode ser manipulado por um serviço JMX padrão. Nós fornecemos uma implementação do MBean na distribuição, <literal>org.hibernate.jmx.HibernateService</literal>."
|
||||
#. Tag: para
|
||||
#: architecture.xml:231
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"JMX is the J2EE standard for management of Java components. Hibernate may be "
|
||||
"managed via a JMX standard service. We provide an MBean implementation in "
|
||||
"the distribution, <literal>org.hibernate.jmx.HibernateService</literal>."
|
||||
msgstr ""
|
||||
"JMX é padrão J2EE para manipulação de componentes Java. O Hibernate pode ser "
|
||||
"manipulado por um serviço JMX padrão. Nós fornecemos uma implementação do "
|
||||
"MBean na distribuição, <literal>org.hibernate.jmx.HibernateService</literal>."
|
||||
|
||||
#: index.docbook:237
|
||||
msgid "For an example how to deploy Hibernate as a JMX service on the JBoss Application Server, please see the JBoss User Guide. On JBoss AS, you also get these benefits if you deploy using JMX:"
|
||||
msgstr "Para um exemplo de como instalar o Hibernate como um serviço JMX em um servidor de aplicativo JBoss, por favor, consulte o manual do usuário do JBoss. No JBoss As, você poderá ver os benefícios de de se fazer o deploy usando JMX:"
|
||||
#. Tag: para
|
||||
#: architecture.xml:237
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"For an example how to deploy Hibernate as a JMX service on the JBoss "
|
||||
"Application Server, please see the JBoss User Guide. On JBoss AS, you also "
|
||||
"get these benefits if you deploy using JMX:"
|
||||
msgstr ""
|
||||
"Para um exemplo de como instalar o Hibernate como um serviço JMX em um "
|
||||
"servidor de aplicativo JBoss, por favor, consulte o manual do usuário do "
|
||||
"JBoss. No JBoss As, você poderá ver os benefícios de de se fazer o deploy "
|
||||
"usando JMX:"
|
||||
|
||||
#: index.docbook:245
|
||||
msgid "<emphasis>Session Management:</emphasis> The Hibernate <literal>Session</literal>'s life cycle can be automatically bound to the scope of a JTA transaction. This means you no longer have to manually open and close the <literal>Session</literal>, this becomes the job of a JBoss EJB interceptor. You also don't have to worry about transaction demarcation in your code anymore (unless you'd like to write a portable persistence layer of course, use the optional Hibernate <literal>Transaction</literal> API for this). You call the <literal>HibernateContext</literal> to access a <literal>Session</literal>."
|
||||
msgstr "<emphasis>Session Management:</emphasis> O ciclo de vida de uma <literal>Session</literal> do Hibernate pode ser automaticamente conectada a um escopo de transação JTA. Isso significa que você não precisará mais abrir e fechar manualmente uma <literal>Session</literal>, isso se torna trabalho para um interceptor EJB do JBoss . Você também não precisa se preocupar, nunca mais, com demarcação de transação em seu código (a não ser que você prefira escrever uma camada persistente portável, para isso, use a API opcional do Hibernate <literal>Transaction</literal>). Você deve chamar <literal>HibernateContext</literal> para acessar uma <literal>Session</literal>."
|
||||
#. Tag: para
|
||||
#: architecture.xml:245
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<emphasis>Session Management:</emphasis> The Hibernate <literal>Session</"
|
||||
"literal>'s life cycle can be automatically bound to the scope of a JTA "
|
||||
"transaction. This means you no longer have to manually open and close the "
|
||||
"<literal>Session</literal>, this becomes the job of a JBoss EJB interceptor. "
|
||||
"You also don't have to worry about transaction demarcation in your code "
|
||||
"anymore (unless you'd like to write a portable persistence layer of course, "
|
||||
"use the optional Hibernate <literal>Transaction</literal> API for this). You "
|
||||
"call the <literal>HibernateContext</literal> to access a <literal>Session</"
|
||||
"literal>."
|
||||
msgstr ""
|
||||
"<emphasis>Session Management:</emphasis> O ciclo de vida de uma "
|
||||
"<literal>Session</literal> do Hibernate pode ser automaticamente conectada a "
|
||||
"um escopo de transação JTA. Isso significa que você não precisará mais abrir "
|
||||
"e fechar manualmente uma <literal>Session</literal>, isso se torna trabalho "
|
||||
"para um interceptor EJB do JBoss . Você também não precisa se preocupar, "
|
||||
"nunca mais, com demarcação de transação em seu código (a não ser que você "
|
||||
"prefira escrever uma camada persistente portável, para isso, use a API "
|
||||
"opcional do Hibernate <literal>Transaction</literal>). Você deve chamar "
|
||||
"<literal>HibernateContext</literal> para acessar uma <literal>Session</"
|
||||
"literal>."
|
||||
|
||||
#: index.docbook:257
|
||||
msgid "<emphasis>HAR deployment:</emphasis> Usually you deploy the Hibernate JMX service using a JBoss service deployment descriptor (in an EAR and/or SAR file), it supports all the usual configuration options of a Hibernate <literal>SessionFactory</literal>. However, you still have to name all your mapping files in the deployment descriptor. If you decide to use the optional HAR deployment, JBoss will automatically detect all mapping files in your HAR file."
|
||||
msgstr "<emphasis>HAR deployment:</emphasis>: Normalmente você faz o deploy de um serviço JMX do Hibernate usando um serviço descritor de deploy do JBoss (em um EAR e/ou arquivo SAR), que suporta todas as configurações usuais de uma <literal>SessionFactory</literal> do Hibernate. Entretanto, você ainda precisa nomear todos os seus arquivos de mapeamento no descritor de deploração. Se você decidir usar o deploy opcional HAR, o JBoss irá automaticamente detectar todos os seus arquivos de mapeamento no seu arquivo HAR."
|
||||
#. Tag: para
|
||||
#: architecture.xml:257
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<emphasis>HAR deployment:</emphasis> Usually you deploy the Hibernate JMX "
|
||||
"service using a JBoss service deployment descriptor (in an EAR and/or SAR "
|
||||
"file), it supports all the usual configuration options of a Hibernate "
|
||||
"<literal>SessionFactory</literal>. However, you still have to name all your "
|
||||
"mapping files in the deployment descriptor. If you decide to use the "
|
||||
"optional HAR deployment, JBoss will automatically detect all mapping files "
|
||||
"in your HAR file."
|
||||
msgstr ""
|
||||
"<emphasis>HAR deployment:</emphasis>: Normalmente você faz o deploy de um "
|
||||
"serviço JMX do Hibernate usando um serviço descritor de deploy do JBoss (em "
|
||||
"um EAR e/ou arquivo SAR), que suporta todas as configurações usuais de uma "
|
||||
"<literal>SessionFactory</literal> do Hibernate. Entretanto, você ainda "
|
||||
"precisa nomear todos os seus arquivos de mapeamento no descritor de "
|
||||
"deploração. Se você decidir usar o deploy opcional HAR, o JBoss irá "
|
||||
"automaticamente detectar todos os seus arquivos de mapeamento no seu arquivo "
|
||||
"HAR."
|
||||
|
||||
#: index.docbook:268
|
||||
msgid "Consult the JBoss AS user guide for more information about these options."
|
||||
msgstr "Consulte o manual do usuário do JBoss AS, para obter maiores informações sobre essas opções."
|
||||
#. Tag: para
|
||||
#: architecture.xml:268
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Consult the JBoss AS user guide for more information about these options."
|
||||
msgstr ""
|
||||
"Consulte o manual do usuário do JBoss AS, para obter maiores informações "
|
||||
"sobre essas opções."
|
||||
|
||||
#: index.docbook:272
|
||||
msgid "Another feature available as a JMX service are runtime Hibernate statistics. See <xref linkend=\"configuration-optional-statistics\"/>."
|
||||
msgstr "Another feature available as a JMX service are runtime Hibernate statistics. See <xref linkend=\"configuration-optional-statistics\"/>. Outra opção disponível como um serviço JMX são as estatísticas de execução do Hibernate. Veja a <xref linkend=\"configuration-optional-statistics\"/>."
|
||||
#. Tag: para
|
||||
#: architecture.xml:272
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Another feature available as a JMX service are runtime Hibernate statistics. "
|
||||
"See <xref linkend=\"configuration-optional-statistics\"/>."
|
||||
msgstr ""
|
||||
"Another feature available as a JMX service are runtime Hibernate statistics. "
|
||||
"See <xref linkend=\"configuration-optional-statistics\"/>. Outra opção "
|
||||
"disponível como um serviço JMX são as estatísticas de execução do Hibernate. "
|
||||
"Veja a <xref linkend=\"configuration-optional-statistics\"/>."
|
||||
|
||||
#: index.docbook:279
|
||||
#. Tag: title
|
||||
#: architecture.xml:279
|
||||
#, no-c-format
|
||||
msgid "JCA Support"
|
||||
msgstr "Suporte JCA"
|
||||
|
||||
#: index.docbook:280
|
||||
msgid "Hibernate may also be configured as a JCA connector. Please see the website for more details. Please note that Hibernate JCA support is still considered experimental."
|
||||
msgstr "Hibernate may also be configured as a JCA connector. Please see the website for more details. Please note that Hibernate JCA support is still considered experimental. O Hibernate pode também ser configurado como um conector JCA. Por favor, visite o website para maiores detalhes. Entretanto, note que o suporte JCA do Hibernate ainda é considerado experimental."
|
||||
#. Tag: para
|
||||
#: architecture.xml:280
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate may also be configured as a JCA connector. Please see the website "
|
||||
"for more details. Please note that Hibernate JCA support is still considered "
|
||||
"experimental."
|
||||
msgstr ""
|
||||
"Hibernate may also be configured as a JCA connector. Please see the website "
|
||||
"for more details. Please note that Hibernate JCA support is still considered "
|
||||
"experimental. O Hibernate pode também ser configurado como um conector JCA. "
|
||||
"Por favor, visite o website para maiores detalhes. Entretanto, note que o "
|
||||
"suporte JCA do Hibernate ainda é considerado experimental."
|
||||
|
||||
#: index.docbook:287
|
||||
#. Tag: title
|
||||
#: architecture.xml:287
|
||||
#, no-c-format
|
||||
msgid "Contextual Sessions"
|
||||
msgstr "Sessões contextuais"
|
||||
|
||||
#: index.docbook:288
|
||||
msgid "Most applications using Hibernate need some form of \"contextual\" sessions, where a given session is in effect throughout the scope of a given context. However, across applications the definition of what constitutes a context is typically different; and different contexts define different scopes to the notion of current. Applications using Hibernate prior to version 3.0 tended to utilize either home-grown <literal>ThreadLocal</literal>-based contextual sessions, helper classes such as <literal>HibernateUtil</literal>, or utilized third-party frameworks (such as Spring or Pico) which provided proxy/interception-based contextual sessions."
|
||||
msgstr "Muitas aplicações que usam o Hibernate necessita de algum tipo de sessão \"contextual\", onde uma sessão dada é na verdade um escopo de um contexto. Entretanto, através de aplicações a definição sobre um contexto é geralmente diferente; e contextos diferentes definem escopos diferentes. Aplicações usando versões anteriores ao Hibernate 3.0 tendem a utilizar tanto sessões contextuais baseadas em <literal>ThreadLocal</literal>, classes utilitárias como <literal>HibernateUtil</literal>, ou utilizar frameworks de terceiros(como Spring ou Pico) que provê sessões contextuais baseadas em proxy."
|
||||
#. Tag: para
|
||||
#: architecture.xml:288
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Most applications using Hibernate need some form of \"contextual\" sessions, "
|
||||
"where a given session is in effect throughout the scope of a given context. "
|
||||
"However, across applications the definition of what constitutes a context is "
|
||||
"typically different; and different contexts define different scopes to the "
|
||||
"notion of current. Applications using Hibernate prior to version 3.0 tended "
|
||||
"to utilize either home-grown <literal>ThreadLocal</literal>-based contextual "
|
||||
"sessions, helper classes such as <literal>HibernateUtil</literal>, or "
|
||||
"utilized third-party frameworks (such as Spring or Pico) which provided "
|
||||
"proxy/interception-based contextual sessions."
|
||||
msgstr ""
|
||||
"Muitas aplicações que usam o Hibernate necessita de algum tipo de sessão "
|
||||
"\"contextual\", onde uma sessão dada é na verdade um escopo de um contexto. "
|
||||
"Entretanto, através de aplicações a definição sobre um contexto é geralmente "
|
||||
"diferente; e contextos diferentes definem escopos diferentes. Aplicações "
|
||||
"usando versões anteriores ao Hibernate 3.0 tendem a utilizar tanto sessões "
|
||||
"contextuais baseadas em <literal>ThreadLocal</literal>, classes utilitárias "
|
||||
"como <literal>HibernateUtil</literal>, ou utilizar frameworks de terceiros"
|
||||
"(como Spring ou Pico) que provê sessões contextuais baseadas em proxy."
|
||||
|
||||
#: index.docbook:297
|
||||
msgid "Starting with version 3.0.1, Hibernate added the <literal>SessionFactory.getCurrentSession()</literal> method. Initially, this assumed usage of <literal>JTA</literal> transactions, where the <literal>JTA</literal> transaction defined both the scope and context of a current session. The Hibernate team maintains that, given the maturity of the numerous stand-alone <literal>JTA TransactionManager</literal> implementations out there, most (if not all) applications should be using <literal>JTA</literal> transaction management whether or not they are deployed into a <literal>J2EE</literal> container. Based on that, the <literal>JTA</literal>-based contextual sessions is all you should ever need to use."
|
||||
msgstr "A partir da versão 3.0.1, o Hibernate adicionou o método <literal>SessionFactory.getCurrentSession()</literal>. Inicialmente, este assume o uso de transações <literal>JTA</literal>, onde a transação <literal>JTA</literal> define tanto o escopo quanto o contexto de uma sessão atual. O time do Hibernate mantém este recurso, desenvolvendo as diversas implementações do <literal>JTA TransactionManager</literal>, a maioria (se não todos) aplicativos deveria utilizar o gerenciador de transações <literal>JTA</literal> sendo ou não instalados dentro de um container <literal>J2EE</literal>. Baseado neste recurso, você deveria sempre utilizar sessões contextuais baseadas em <literal>JTA</literal>."
|
||||
#. Tag: para
|
||||
#: architecture.xml:297
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Starting with version 3.0.1, Hibernate added the <literal>SessionFactory."
|
||||
"getCurrentSession()</literal> method. Initially, this assumed usage of "
|
||||
"<literal>JTA</literal> transactions, where the <literal>JTA</literal> "
|
||||
"transaction defined both the scope and context of a current session. The "
|
||||
"Hibernate team maintains that, given the maturity of the numerous stand-"
|
||||
"alone <literal>JTA TransactionManager</literal> implementations out there, "
|
||||
"most (if not all) applications should be using <literal>JTA</literal> "
|
||||
"transaction management whether or not they are deployed into a "
|
||||
"<literal>J2EE</literal> container. Based on that, the <literal>JTA</literal>-"
|
||||
"based contextual sessions is all you should ever need to use."
|
||||
msgstr ""
|
||||
"A partir da versão 3.0.1, o Hibernate adicionou o método "
|
||||
"<literal>SessionFactory.getCurrentSession()</literal>. Inicialmente, este "
|
||||
"assume o uso de transações <literal>JTA</literal>, onde a transação "
|
||||
"<literal>JTA</literal> define tanto o escopo quanto o contexto de uma sessão "
|
||||
"atual. O time do Hibernate mantém este recurso, desenvolvendo as diversas "
|
||||
"implementações do <literal>JTA TransactionManager</literal>, a maioria (se "
|
||||
"não todos) aplicativos deveria utilizar o gerenciador de transações "
|
||||
"<literal>JTA</literal> sendo ou não instalados dentro de um container "
|
||||
"<literal>J2EE</literal>. Baseado neste recurso, você deveria sempre utilizar "
|
||||
"sessões contextuais baseadas em <literal>JTA</literal>."
|
||||
|
||||
#: index.docbook:307
|
||||
msgid "However, as of version 3.1, the processing behind <literal>SessionFactory.getCurrentSession()</literal> is now pluggable. To that end, a new extension interface (<literal>org.hibernate.context.CurrentSessionContext</literal>) and a new configuration parameter (<literal>hibernate.current_session_context_class</literal>) have been added to allow pluggability of the scope and context of defining current sessions."
|
||||
msgstr "Entretanto, na versão 3.1, o processo por trás do método <literal>SessionFactory.getCurrentSession()</literal> é agora plugavel. Com isso, uma nova interface (<literal>org.hibernate.context.CurrentSessionContext</literal>) e um novo parâmetro de configuração (<literal>hibernate.current_session_context_class</literal>) foram adicionados para possibilitar a compatibilidade do contexto e do escopo na definição de sessões correntes."
|
||||
#. Tag: para
|
||||
#: architecture.xml:307
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"However, as of version 3.1, the processing behind <literal>SessionFactory."
|
||||
"getCurrentSession()</literal> is now pluggable. To that end, a new extension "
|
||||
"interface (<literal>org.hibernate.context.CurrentSessionContext</literal>) "
|
||||
"and a new configuration parameter (<literal>hibernate."
|
||||
"current_session_context_class</literal>) have been added to allow "
|
||||
"pluggability of the scope and context of defining current sessions."
|
||||
msgstr ""
|
||||
"Entretanto, na versão 3.1, o processo por trás do método "
|
||||
"<literal>SessionFactory.getCurrentSession()</literal> é agora plugavel. Com "
|
||||
"isso, uma nova interface (<literal>org.hibernate.context."
|
||||
"CurrentSessionContext</literal>) e um novo parâmetro de configuração "
|
||||
"(<literal>hibernate.current_session_context_class</literal>) foram "
|
||||
"adicionados para possibilitar a compatibilidade do contexto e do escopo na "
|
||||
"definição de sessões correntes."
|
||||
|
||||
#: index.docbook:314
|
||||
msgid "See the Javadocs for the <literal>org.hibernate.context.CurrentSessionContext</literal> interface for a detailed discussion of its contract. It defines a single method, <literal>currentSession()</literal>, by which the implementation is responsible for tracking the current contextual session. Out-of-the-box, Hibernate comes with three implementations of this interface."
|
||||
msgstr "De uma olhada em Javadocs sobre a interface <literal>org.hibernate.context.CurrentSessionContext</literal> para uma discussão detalhada. Ela define um método único, <literal>currentSession()</literal>, com o qual a implementação é responsável por rastrear a sessão contextual corrente. Por fora do \"encapsulamento\", o Hibernate possui duas implementações dessa interface."
|
||||
#. Tag: para
|
||||
#: architecture.xml:314
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"See the Javadocs for the <literal>org.hibernate.context."
|
||||
"CurrentSessionContext</literal> interface for a detailed discussion of its "
|
||||
"contract. It defines a single method, <literal>currentSession()</literal>, "
|
||||
"by which the implementation is responsible for tracking the current "
|
||||
"contextual session. Out-of-the-box, Hibernate comes with three "
|
||||
"implementations of this interface."
|
||||
msgstr ""
|
||||
"De uma olhada em Javadocs sobre a interface <literal>org.hibernate.context."
|
||||
"CurrentSessionContext</literal> para uma discussão detalhada. Ela define um "
|
||||
"método único, <literal>currentSession()</literal>, com o qual a "
|
||||
"implementação é responsável por rastrear a sessão contextual corrente. Por "
|
||||
"fora do \"encapsulamento\", o Hibernate possui duas implementações dessa "
|
||||
"interface."
|
||||
|
||||
#: index.docbook:324
|
||||
msgid "<literal>org.hibernate.context.JTASessionContext</literal> - current sessions are tracked and scoped by a <literal>JTA</literal> transaction. The processing here is exactly the same as in the older JTA-only approach. See the Javadocs for details."
|
||||
msgstr "<literal>org.hibernate.context.JTASessionContext</literal> - As sessões correntes são rastreadas e recebem um escopo por uma transação <literal>JTA</literal>. O processamento aqui é exatamente igual ao antigo processo JTA. Consulte em Javadocs para maiores detalhes."
|
||||
#. Tag: para
|
||||
#: architecture.xml:324
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<literal>org.hibernate.context.JTASessionContext</literal> - current "
|
||||
"sessions are tracked and scoped by a <literal>JTA</literal> transaction. The "
|
||||
"processing here is exactly the same as in the older JTA-only approach. See "
|
||||
"the Javadocs for details."
|
||||
msgstr ""
|
||||
"<literal>org.hibernate.context.JTASessionContext</literal> - As sessões "
|
||||
"correntes são rastreadas e recebem um escopo por uma transação <literal>JTA</"
|
||||
"literal>. O processamento aqui é exatamente igual ao antigo processo JTA. "
|
||||
"Consulte em Javadocs para maiores detalhes."
|
||||
|
||||
#: index.docbook:332
|
||||
msgid "<literal>org.hibernate.context.ThreadLocalSessionContext</literal> - current sessions are tracked by thread of execution. Again, see the Javadocs for details."
|
||||
msgstr "<literal>org.hibernate.context.ThreadLocalSessionContext</literal> - As sessões correntes são rastreadas por uma thread de execução. Novamente, consulte em Javadocs para maiores detalhes."
|
||||
#. Tag: para
|
||||
#: architecture.xml:332
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<literal>org.hibernate.context.ThreadLocalSessionContext</literal> - current "
|
||||
"sessions are tracked by thread of execution. Again, see the Javadocs for "
|
||||
"details."
|
||||
msgstr ""
|
||||
"<literal>org.hibernate.context.ThreadLocalSessionContext</literal> - As "
|
||||
"sessões correntes são rastreadas por uma thread de execução. Novamente, "
|
||||
"consulte em Javadocs para maiores detalhes."
|
||||
|
||||
#: index.docbook:338
|
||||
msgid "<literal>org.hibernate.context.ManagedSessionContext</literal> - current sessions are tracked by thread of execution. However, you are responsible to bind and unbind a <literal>Session</literal> instance with static methods on this class, it does never open, flush, or close a <literal>Session</literal>."
|
||||
msgstr "<literal>org.hibernate.context.ManagedSessionContext</literal> - current sessions are tracked by thread of execution. However, you are responsible to bind and unbind a <literal>Session</literal> instance with static methods on this class, it does never open, flush, or close a <literal>Session</literal>."
|
||||
#. Tag: para
|
||||
#: architecture.xml:338
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<literal>org.hibernate.context.ManagedSessionContext</literal> - current "
|
||||
"sessions are tracked by thread of execution. However, you are responsible to "
|
||||
"bind and unbind a <literal>Session</literal> instance with static methods on "
|
||||
"this class, it does never open, flush, or close a <literal>Session</literal>."
|
||||
msgstr ""
|
||||
"<literal>org.hibernate.context.ManagedSessionContext</literal> - current "
|
||||
"sessions are tracked by thread of execution. However, you are responsible to "
|
||||
"bind and unbind a <literal>Session</literal> instance with static methods on "
|
||||
"this class, it does never open, flush, or close a <literal>Session</literal>."
|
||||
|
||||
#: index.docbook:347
|
||||
msgid "The first two implementations provide a \"one session - one database transaction\" programming model, also known and used as <emphasis>session-per-request</emphasis>. The beginning and end of a Hibernate session is defined by the duration of a database transaction. If you use programatic transaction demarcation in plain JSE without JTA, you are adviced to use the Hibernate <literal>Transaction</literal> API to hide the underlying transaction system from your code. If you use JTA, use the JTA interfaces to demarcate transactions. If you execute in an EJB container that supports CMT, transaction boundaries are defined declaratively and you don't need any transaction or session demarcation operations in your code. Refer to <xref linkend=\"transactions\"/> for more information and code examples."
|
||||
msgstr "As duas primeiras implementações usam o modelo de programação \"uma sessão – uma transação do banco de dados\", também conhecida e usado como <emphasis>sessão por requisição</emphasis>. O começo e o fim de uma sessão Hibernate é definida pela duração da transação do banco de dados. Se você usa demarcação programática de transação (por exemplo. em J2SE puro ou com JTA /UserTransaction/BMT), você é recomendado a usar a API Hibernate <literal>Transaction</literal> para esconder a base do sistema de transação do seu código. Se você executa em um container EJB que suporta CMT, os limites das transações são definidas declarativamente e você não necessita de qualquer transação ou operação de demarcação de sessão no seu código. Consulte o <xref linkend=\"transactions\"/> para mais informações exemplos de código."
|
||||
|
||||
#: index.docbook:359
|
||||
msgid "The <literal>hibernate.current_session_context_class</literal> configuration parameter defines which <literal>org.hibernate.context.CurrentSessionContext</literal> implementation should be used. Note that for backwards compatibility, if this config param is not set but a <literal>org.hibernate.transaction.TransactionManagerLookup</literal> is configured, Hibernate will use the <literal>org.hibernate.context.JTASessionContext</literal>. Typically, the value of this parameter would just name the implementation class to use; for the three out-of-the-box implementations, however, there are three corresponding short names, \"jta\", \"thread\", and \"managed\"."
|
||||
msgstr "O parâmetro de configuração <literal>hibernate.current_session_context_class</literal> define que a implementação <literal>org.hibernate.context.CurrentSessionContext</literal> deve ser usada. Note que para compatibilidade anterior, se este parâmetro de configuração não é determinado mas um <literal>org.hibernate.transaction.TransactionManagerLookup</literal> é configurado, Hibernate usará o <literal>org.hibernate.context.JTASessionContext</literal>. Tipicamente, o valor deste parâmetro nomearia apenas a classe de implementação para usar; para as duas implementações out-of-the-box, entretanto, há três pequenos nomes correspondentes, \"jta\", \"thread\", and \"managed\"."
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
#. Tag: para
|
||||
#: architecture.xml:347
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The first two implementations provide a \"one session - one database "
|
||||
"transaction\" programming model, also known and used as <emphasis>session-"
|
||||
"per-request</emphasis>. The beginning and end of a Hibernate session is "
|
||||
"defined by the duration of a database transaction. If you use programatic "
|
||||
"transaction demarcation in plain JSE without JTA, you are adviced to use the "
|
||||
"Hibernate <literal>Transaction</literal> API to hide the underlying "
|
||||
"transaction system from your code. If you use JTA, use the JTA interfaces to "
|
||||
"demarcate transactions. If you execute in an EJB container that supports "
|
||||
"CMT, transaction boundaries are defined declaratively and you don't need any "
|
||||
"transaction or session demarcation operations in your code. Refer to <xref "
|
||||
"linkend=\"transactions\"/> for more information and code examples."
|
||||
msgstr ""
|
||||
"As duas primeiras implementações usam o modelo de programação \"uma sessão – "
|
||||
"uma transação do banco de dados\", também conhecida e usado como "
|
||||
"<emphasis>sessão por requisição</emphasis>. O começo e o fim de uma sessão "
|
||||
"Hibernate é definida pela duração da transação do banco de dados. Se você "
|
||||
"usa demarcação programática de transação (por exemplo. em J2SE puro ou com "
|
||||
"JTA /UserTransaction/BMT), você é recomendado a usar a API Hibernate "
|
||||
"<literal>Transaction</literal> para esconder a base do sistema de transação "
|
||||
"do seu código. Se você executa em um container EJB que suporta CMT, os "
|
||||
"limites das transações são definidas declarativamente e você não necessita "
|
||||
"de qualquer transação ou operação de demarcação de sessão no seu código. "
|
||||
"Consulte o <xref linkend=\"transactions\"/> para mais informações exemplos "
|
||||
"de código."
|
||||
|
||||
#. Tag: para
|
||||
#: architecture.xml:359
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The <literal>hibernate.current_session_context_class</literal> configuration "
|
||||
"parameter defines which <literal>org.hibernate.context."
|
||||
"CurrentSessionContext</literal> implementation should be used. Note that for "
|
||||
"backwards compatibility, if this config param is not set but a <literal>org."
|
||||
"hibernate.transaction.TransactionManagerLookup</literal> is configured, "
|
||||
"Hibernate will use the <literal>org.hibernate.context.JTASessionContext</"
|
||||
"literal>. Typically, the value of this parameter would just name the "
|
||||
"implementation class to use; for the three out-of-the-box implementations, "
|
||||
"however, there are three corresponding short names, \"jta\", \"thread\", and "
|
||||
"\"managed\"."
|
||||
msgstr ""
|
||||
"O parâmetro de configuração <literal>hibernate."
|
||||
"current_session_context_class</literal> define que a implementação "
|
||||
"<literal>org.hibernate.context.CurrentSessionContext</literal> deve ser "
|
||||
"usada. Note que para compatibilidade anterior, se este parâmetro de "
|
||||
"configuração não é determinado mas um <literal>org.hibernate.transaction."
|
||||
"TransactionManagerLookup</literal> é configurado, Hibernate usará o "
|
||||
"<literal>org.hibernate.context.JTASessionContext</literal>. Tipicamente, o "
|
||||
"valor deste parâmetro nomearia apenas a classe de implementação para usar; "
|
||||
"para as duas implementações out-of-the-box, entretanto, há três pequenos "
|
||||
"nomes correspondentes, \"jta\", \"thread\", and \"managed\"."
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,281 +1,650 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: batch.xml:5
|
||||
#, no-c-format
|
||||
msgid "Batch processing"
|
||||
msgstr ""
|
||||
msgstr "Processamento de lotes"
|
||||
|
||||
#: index.docbook:7
|
||||
msgid "A naive approach to inserting 100 000 rows in the database using Hibernate might look like this:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:12
|
||||
#. Tag: para
|
||||
#: batch.xml:7
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"for ( int i=0; i<100000; i++ ) {\n"
|
||||
" Customer customer = new Customer(.....);\n"
|
||||
" session.save(customer);\n"
|
||||
"}\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"A naive approach to inserting 100 000 rows in the database using Hibernate "
|
||||
"might look like this:"
|
||||
msgstr ""
|
||||
"Uma alternativa para inserir 100.000 linhas no banco de dados usando o "
|
||||
"Hibernate pode ser a seguinte:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:12
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"for ( int i=0; i<100000; i++ ) {\n"
|
||||
" Customer customer = new Customer(.....);\n"
|
||||
" session.save(customer);\n"
|
||||
"}\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:14
|
||||
msgid "This would fall over with an <literal>OutOfMemoryException</literal> somewhere around the 50 000th row. That's because Hibernate caches all the newly inserted <literal>Customer</literal> instances in the session-level cache."
|
||||
#. Tag: para
|
||||
#: batch.xml:14
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This would fall over with an <literal>OutOfMemoryException</literal> "
|
||||
"somewhere around the 50 000th row. That's because Hibernate caches all the "
|
||||
"newly inserted <literal>Customer</literal> instances in the session-level "
|
||||
"cache."
|
||||
msgstr ""
|
||||
"Isto irá falhar em algum lugar próximo a linha 50.000, lançando uma "
|
||||
"<literal>OutOfMemoryException</literal>. Isso ocorre devido ao fato do "
|
||||
"Hibernate fazer cache de todas as instâncias de <literal>Customer</literal> "
|
||||
"inseridas num cachê em nível de sessão."
|
||||
|
||||
#: index.docbook:20
|
||||
msgid "In this chapter we'll show you how to avoid this problem. First, however, if you are doing batch processing, it is absolutely critical that you enable the use of JDBC batching, if you intend to achieve reasonable performance. Set the JDBC batch size to a reasonable number (say, 10-50):"
|
||||
#. Tag: para
|
||||
#: batch.xml:20
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"In this chapter we'll show you how to avoid this problem. First, however, if "
|
||||
"you are doing batch processing, it is absolutely critical that you enable "
|
||||
"the use of JDBC batching, if you intend to achieve reasonable performance. "
|
||||
"Set the JDBC batch size to a reasonable number (say, 10-50):"
|
||||
msgstr ""
|
||||
"Neste capítulo veremos como contornar esse problema. Entretanto, se você vai "
|
||||
"realizar processamento de lotes, é muito importante que você habilite o uso "
|
||||
"de lotes JDBC, se você pretende obter um desempenho razoável. Defina o "
|
||||
"tamanho do lote JDBC em um valor razoável (algo entre 10-50):"
|
||||
|
||||
#: index.docbook:27
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:27
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[hibernate.jdbc.batch_size 20]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:29
|
||||
msgid "Note that Hibernate disables insert batching at the JDBC level transparently if you use an <literal>identiy</literal> identifier generator."
|
||||
#. Tag: para
|
||||
#: batch.xml:29
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note that Hibernate disables insert batching at the JDBC level transparently "
|
||||
"if you use an <literal>identiy</literal> identifier generator."
|
||||
msgstr ""
|
||||
"Você também pode querer rodar esse tipo de processamento de lotes com o "
|
||||
"cache secundário completamente desabilitado:"
|
||||
|
||||
#: index.docbook:34
|
||||
msgid "You also might like to do this kind of work in a process where interaction with the second-level cache is completely disabled:"
|
||||
#. Tag: para
|
||||
#: batch.xml:34
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"You also might like to do this kind of work in a process where interaction "
|
||||
"with the second-level cache is completely disabled:"
|
||||
msgstr ""
|
||||
"Note that Hibernate disables insert batching at the JDBC level transparently "
|
||||
"if you use an <literal>identiy</literal> identifier generator."
|
||||
|
||||
#: index.docbook:39
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:39
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[hibernate.cache.use_second_level_cache false]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:41
|
||||
msgid "However, this is not absolutely necessary, since we can explicitly set the <literal>CacheMode</literal> to disable interaction with the second-level cache."
|
||||
#. Tag: para
|
||||
#: batch.xml:41
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"However, this is not absolutely necessary, since we can explicitly set the "
|
||||
"<literal>CacheMode</literal> to disable interaction with the second-level "
|
||||
"cache."
|
||||
msgstr ""
|
||||
"Mas isto não é absolutamente necessário, desde que nós possamos ajustar o "
|
||||
"<literal>CacheMode</literal> para desabilitar a interação com o cache "
|
||||
"secundário."
|
||||
|
||||
#: index.docbook:47
|
||||
#. Tag: title
|
||||
#: batch.xml:47
|
||||
#, no-c-format
|
||||
msgid "Batch inserts"
|
||||
msgstr ""
|
||||
msgstr "Inserção de lotes"
|
||||
|
||||
#: index.docbook:49
|
||||
msgid "When making new objects persistent, you must <literal>flush()</literal> and then <literal>clear()</literal> the session regularly, to control the size of the first-level cache."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:55
|
||||
#. Tag: para
|
||||
#: batch.xml:49
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"for ( int i=0; i<100000; i++ ) {\n"
|
||||
" Customer customer = new Customer(.....);\n"
|
||||
" session.save(customer);\n"
|
||||
" if ( i % 20 == 0 ) { //20, same as the JDBC batch size\n"
|
||||
" //flush a batch of inserts and release memory:\n"
|
||||
" session.flush();\n"
|
||||
" session.clear();\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"When making new objects persistent, you must <literal>flush()</literal> and "
|
||||
"then <literal>clear()</literal> the session regularly, to control the size "
|
||||
"of the first-level cache."
|
||||
msgstr ""
|
||||
"Quando você estiver inserindo novos objetos persistentes, vocês deve "
|
||||
"executar os métodos <literal>flush()</literal> e <literal>clear()</literal> "
|
||||
"regularmente na sessão, para controlar o tamanho do cache primário."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:55
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"for ( int i=0; i<100000; i++ ) {\n"
|
||||
" Customer customer = new Customer(.....);\n"
|
||||
" session.save(customer);\n"
|
||||
" if ( i % 20 == 0 ) { //20, same as the JDBC batch size\n"
|
||||
" //flush a batch of inserts and release memory:\n"
|
||||
" session.flush();\n"
|
||||
" session.clear();\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:60
|
||||
#. Tag: title
|
||||
#: batch.xml:60
|
||||
#, no-c-format
|
||||
msgid "Batch updates"
|
||||
msgstr ""
|
||||
msgstr "Batch updates"
|
||||
|
||||
#: index.docbook:62
|
||||
msgid "For retrieving and updating data the same ideas apply. In addition, you need to use <literal>scroll()</literal> to take advantage of server-side cursors for queries that return many rows of data."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:68
|
||||
#. Tag: para
|
||||
#: batch.xml:62
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n"
|
||||
" .setCacheMode(CacheMode.IGNORE)\n"
|
||||
" .scroll(ScrollMode.FORWARD_ONLY);\n"
|
||||
"int count=0;\n"
|
||||
"while ( customers.next() ) {\n"
|
||||
" Customer customer = (Customer) customers.get(0);\n"
|
||||
" customer.updateStuff(...);\n"
|
||||
" if ( ++count % 20 == 0 ) {\n"
|
||||
" //flush a batch of updates and release memory:\n"
|
||||
" session.flush();\n"
|
||||
" session.clear();\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"For retrieving and updating data the same ideas apply. In addition, you need "
|
||||
"to use <literal>scroll()</literal> to take advantage of server-side cursors "
|
||||
"for queries that return many rows of data."
|
||||
msgstr ""
|
||||
"Para recuperar e atualizar informações a mesma idéia é válida. "
|
||||
"Adicionalmente, pode precisar usar o <literal>scroll()</literal> para usar "
|
||||
"recursos no lado do servidor em queries que retornam muita informação."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:68
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n"
|
||||
" .setCacheMode(CacheMode.IGNORE)\n"
|
||||
" .scroll(ScrollMode.FORWARD_ONLY);\n"
|
||||
"int count=0;\n"
|
||||
"while ( customers.next() ) {\n"
|
||||
" Customer customer = (Customer) customers.get(0);\n"
|
||||
" customer.updateStuff(...);\n"
|
||||
" if ( ++count % 20 == 0 ) {\n"
|
||||
" //flush a batch of updates and release memory:\n"
|
||||
" session.flush();\n"
|
||||
" session.clear();\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:73
|
||||
#. Tag: title
|
||||
#: batch.xml:73
|
||||
#, no-c-format
|
||||
msgid "The StatelessSession interface"
|
||||
msgstr ""
|
||||
msgstr "A interface StatelessSession"
|
||||
|
||||
#: index.docbook:74
|
||||
msgid "Alternatively, Hibernate provides a command-oriented API that may be used for streaming data to and from the database in the form of detached objects. A <literal>StatelessSession</literal> has no persistence context associated with it and does not provide many of the higher-level life cycle semantics. In particular, a stateless session does not implement a first-level cache nor interact with any second-level or query cache. It does not implement transactional write-behind or automatic dirty checking. Operations performed using a stateless session do not ever cascade to associated instances. Collections are ignored by a stateless session. Operations performed via a stateless session bypass Hibernate's event model and interceptors. Stateless sessions are vulnerable to data aliasing effects, due to the lack of a first-level cache. A stateless session is a lower-level abstraction, much closer to the underlying JDBC."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:89
|
||||
#. Tag: para
|
||||
#: batch.xml:74
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[StatelessSession session = sessionFactory.openStatelessSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n"
|
||||
" .scroll(ScrollMode.FORWARD_ONLY);\n"
|
||||
"while ( customers.next() ) {\n"
|
||||
" Customer customer = (Customer) customers.get(0);\n"
|
||||
" customer.updateStuff(...);\n"
|
||||
" session.update(customer);\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"Alternatively, Hibernate provides a command-oriented API that may be used "
|
||||
"for streaming data to and from the database in the form of detached objects. "
|
||||
"A <literal>StatelessSession</literal> has no persistence context associated "
|
||||
"with it and does not provide many of the higher-level life cycle semantics. "
|
||||
"In particular, a stateless session does not implement a first-level cache "
|
||||
"nor interact with any second-level or query cache. It does not implement "
|
||||
"transactional write-behind or automatic dirty checking. Operations performed "
|
||||
"using a stateless session do not ever cascade to associated instances. "
|
||||
"Collections are ignored by a stateless session. Operations performed via a "
|
||||
"stateless session bypass Hibernate's event model and interceptors. Stateless "
|
||||
"sessions are vulnerable to data aliasing effects, due to the lack of a first-"
|
||||
"level cache. A stateless session is a lower-level abstraction, much closer "
|
||||
"to the underlying JDBC."
|
||||
msgstr ""
|
||||
"Alternativamente, o Hibernate provê uma API orientada à comandos, usada para "
|
||||
"transmitir um fluxo de dados de e para o banco de dados na forma de objetos "
|
||||
"soltos. Uma <literal>StatelessSession</literal> não tem um contexto "
|
||||
"persistente associado e não fornece muito das semânticas de alto nível para "
|
||||
"controle do ciclo de vida. Em especial, uma StatelessSession não implemente "
|
||||
"o cache primário e nem interage com o cache secundário ou query cache. Ele "
|
||||
"não implementa salvamento transacional automatico ou checagem automática de "
|
||||
"mudanças. Operação realizadas usando uma StatelessSession não fazem nenhum "
|
||||
"tipo de cascade com as instancias associadas. As coleções são ignoradas por "
|
||||
"uma StatelessSession. Operações realizadas com um StatelessSession ignoram a "
|
||||
"arquitetura de eventos e os interceptadores. StatelessSession são "
|
||||
"vulneráveis aos efeitos do aliasing dos dados, devido a falta do cache "
|
||||
"primário. Uma StatelessSession é uma abstração de baixo nível, muito mais "
|
||||
"próxima do JDBC."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:89
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[StatelessSession session = sessionFactory.openStatelessSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
" \n"
|
||||
"ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n"
|
||||
" .scroll(ScrollMode.FORWARD_ONLY);\n"
|
||||
"while ( customers.next() ) {\n"
|
||||
" Customer customer = (Customer) customers.get(0);\n"
|
||||
" customer.updateStuff(...);\n"
|
||||
" session.update(customer);\n"
|
||||
"}\n"
|
||||
" \n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:91
|
||||
msgid "Note that in this code example, the <literal>Customer</literal> instances returned by the query are immediately detached. They are never associated with any persistence context."
|
||||
#. Tag: para
|
||||
#: batch.xml:91
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note that in this code example, the <literal>Customer</literal> instances "
|
||||
"returned by the query are immediately detached. They are never associated "
|
||||
"with any persistence context."
|
||||
msgstr ""
|
||||
"Veja neste exempo, as instancias de <literal>Customer</literal> retornadas "
|
||||
"pela query são imediatamente desvinculadas. Elas nunca serão assossiadas à "
|
||||
"um contexto persistente."
|
||||
|
||||
#: index.docbook:97
|
||||
msgid "The <literal>insert(), update()</literal> and <literal>delete()</literal> operations defined by the <literal>StatelessSession</literal> interface are considered to be direct database row-level operations, which result in immediate execution of a SQL <literal>INSERT, UPDATE</literal> or <literal>DELETE</literal> respectively. Thus, they have very different semantics to the <literal>save(), saveOrUpdate()</literal> and <literal>delete()</literal> operations defined by the <literal>Session</literal> interface."
|
||||
#. Tag: para
|
||||
#: batch.xml:97
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The <literal>insert(), update()</literal> and <literal>delete()</literal> "
|
||||
"operations defined by the <literal>StatelessSession</literal> interface are "
|
||||
"considered to be direct database row-level operations, which result in "
|
||||
"immediate execution of a SQL <literal>INSERT, UPDATE</literal> or "
|
||||
"<literal>DELETE</literal> respectively. Thus, they have very different "
|
||||
"semantics to the <literal>save(), saveOrUpdate()</literal> and "
|
||||
"<literal>delete()</literal> operations defined by the <literal>Session</"
|
||||
"literal> interface."
|
||||
msgstr ""
|
||||
"As operações <literal>insert(), update()</literal> e <literal>delete()</"
|
||||
"literal> definidos pela interface <literal>StatelessSession</literal> são "
|
||||
"considerados operações diretas no banco de dados (row-level operations), "
|
||||
"isso resulta em uma execução imediata de comandos SQL <literal>INSERT, "
|
||||
"UPDATE</literal> ou <literal>DELETE</literal> respectivamente. Devido a "
|
||||
"isso, eles possuem uma semântica bem diferente das operações <literal>save"
|
||||
"(), saveOrUpdate()</literal> ou <literal>delete()</literal> definidas na "
|
||||
"interface <literal>Session</literal>."
|
||||
|
||||
#: index.docbook:110
|
||||
#. Tag: title
|
||||
#: batch.xml:110
|
||||
#, no-c-format
|
||||
msgid "DML-style operations"
|
||||
msgstr ""
|
||||
msgstr "Operações no estilo DML"
|
||||
|
||||
#: index.docbook:112
|
||||
msgid "As already discussed, automatic and transparent object/relational mapping is concerned with the management of object state. This implies that the object state is available in memory, hence manipulating (using the SQL <literal>Data Manipulation Language</literal> (DML) statements: <literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE</literal>) data directly in the database will not affect in-memory state. However, Hibernate provides methods for bulk SQL-style DML statement execution which are performed through the Hibernate Query Language (<xref linkend=\"queryhql\"/>HQL)."
|
||||
#. Tag: para
|
||||
#: batch.xml:112
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"As already discussed, automatic and transparent object/relational mapping is "
|
||||
"concerned with the management of object state. This implies that the object "
|
||||
"state is available in memory, hence manipulating (using the SQL "
|
||||
"<literal>Data Manipulation Language</literal> (DML) statements: "
|
||||
"<literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE</"
|
||||
"literal>) data directly in the database will not affect in-memory state. "
|
||||
"However, Hibernate provides methods for bulk SQL-style DML statement "
|
||||
"execution which are performed through the Hibernate Query Language (<link "
|
||||
"linkend=\"queryhql\">HQL</link>)."
|
||||
msgstr ""
|
||||
"Como já discutido, mapeamento objeto/relacional automático e transparente é "
|
||||
"conseguido com a gerência do estado do objeto. Com isto o estado daquele "
|
||||
"objeto fica disponível na memória, manipulando(usando as expressões SQL "
|
||||
"<literal>Data Manipulation Language</literal> (SQL-style DML): "
|
||||
"<literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE</"
|
||||
"literal>) os dados diretamente no banco de dados não irá afetar o estado "
|
||||
"registrado em memória. Entretanto, o Hibernate provê métodos para executar "
|
||||
"queries SQL-style DML, que são totalmente executas com HQL (Hibernate Query "
|
||||
"Language) (<xref linkend=\"queryhql\">HQL</xref>)."
|
||||
|
||||
#: index.docbook:122
|
||||
msgid "The pseudo-syntax for <literal>UPDATE</literal> and <literal>DELETE</literal> statements is: <literal>( UPDATE | DELETE ) FROM? EntityName (WHERE where_conditions)?</literal>. Some points to note:"
|
||||
#. Tag: para
|
||||
#: batch.xml:122
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The pseudo-syntax for <literal>UPDATE</literal> and <literal>DELETE</"
|
||||
"literal> statements is: <literal>( UPDATE | DELETE ) FROM? EntityName (WHERE "
|
||||
"where_conditions)?</literal>. Some points to note:"
|
||||
msgstr ""
|
||||
"A pseudo-sintaxe para expressões <literal>UPDATE</literal> e "
|
||||
"<literal>DELETE</literal> é: <literal>( UPDATE | DELETE ) FROM? NomeEntidade "
|
||||
"(WHERE condições_where)?</literal>. Algumas observações:"
|
||||
|
||||
#: index.docbook:130
|
||||
#. Tag: para
|
||||
#: batch.xml:130
|
||||
#, no-c-format
|
||||
msgid "In the from-clause, the FROM keyword is optional"
|
||||
msgstr ""
|
||||
msgstr "Na clausula from, a palavra chave FROM é opcional;"
|
||||
|
||||
#: index.docbook:135
|
||||
msgid "There can only be a single entity named in the from-clause; it can optionally be aliased. If the entity name is aliased, then any property references must be qualified using that alias; if the entity name is not aliased, then it is illegal for any property references to be qualified."
|
||||
#. Tag: para
|
||||
#: batch.xml:135
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"There can only be a single entity named in the from-clause; it can "
|
||||
"optionally be aliased. If the entity name is aliased, then any property "
|
||||
"references must be qualified using that alias; if the entity name is not "
|
||||
"aliased, then it is illegal for any property references to be qualified."
|
||||
msgstr ""
|
||||
"Somente uma entidade pode ser chamada na clausula from; opcionalmente pode "
|
||||
"ter um alias. Se o nome da entidade for possuir um alias, então qualquer "
|
||||
"propriedade referenciada deve usar esse alias qualificado; se o nome da "
|
||||
"entidade não possuir um alias, então nenhuma das propriedade precisa usar o "
|
||||
"acesso qualificado."
|
||||
|
||||
#: index.docbook:143
|
||||
msgid "No <xref linkend=\"queryhql-joins-forms\"/>joins (either implicit or explicit) can be specified in a bulk HQL query. Sub-queries may be used in the where-clause; the subqueries, themselves, may contain joins."
|
||||
#. Tag: para
|
||||
#: batch.xml:143
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"No <link linkend=\"queryhql-joins-forms\">joins</link> (either implicit or "
|
||||
"explicit) can be specified in a bulk HQL query. Sub-queries may be used in "
|
||||
"the where-clause; the subqueries, themselves, may contain joins."
|
||||
msgstr ""
|
||||
"Na <xref linkend=\"queryhql-joins-forms\">joins</xref> (ambas implícita ou "
|
||||
"explicita) pode ser especificada em um bulk HQL query. Sub-queries podem ser "
|
||||
"usadas na clausula where; as subqueries podem conter joins."
|
||||
|
||||
#: index.docbook:150
|
||||
#. Tag: para
|
||||
#: batch.xml:150
|
||||
#, no-c-format
|
||||
msgid "The where-clause is also optional."
|
||||
msgstr ""
|
||||
msgstr "A clausula where também é opcional."
|
||||
|
||||
#: index.docbook:156
|
||||
msgid "As an example, to execute an HQL <literal>UPDATE</literal>, use the <literal>Query.executeUpdate()</literal> method (the method is named for those familiar with JDBC's <literal>PreparedStatement.executeUpdate()</literal>):"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:162
|
||||
#. Tag: para
|
||||
#: batch.xml:156
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"String hqlUpdate = \"update Customer c set c.name = :newName where c.name = :oldName\";\n"
|
||||
"// or String hqlUpdate = \"update Customer set name = :newName where name = :oldName\";\n"
|
||||
"int updatedEntities = s.createQuery( hqlUpdate )\n"
|
||||
" .setString( \"newName\", newName )\n"
|
||||
" .setString( \"oldName\", oldName )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"As an example, to execute an HQL <literal>UPDATE</literal>, use the "
|
||||
"<literal>Query.executeUpdate()</literal> method (the method is named for "
|
||||
"those familiar with JDBC's <literal>PreparedStatement.executeUpdate()</"
|
||||
"literal>):"
|
||||
msgstr ""
|
||||
"Como exemplo para executar um HQL <literal>UPDATE</literal>, use o método "
|
||||
"<literal>Query.executeUpdate()</literal>(o método ganhou o nome devido a sua "
|
||||
"familiaridade com o do JDBC <literal>PreparedStatement.executeUpdate()</"
|
||||
"literal>):"
|
||||
|
||||
#: index.docbook:164
|
||||
msgid "HQL <literal>UPDATE</literal> statements, by default do not effect the <xref linkend=\"mapping-declaration-version\"/>version or the <xref linkend=\"mapping-declaration-timestamp\"/>timestamp property values for the affected entities; this is in keeping with the EJB3 specification. However, you can force Hibernate to properly reset the <literal>version</literal> or <literal>timestamp</literal> property values through the use of a <literal>versioned update</literal>. This is achieved by adding the <literal>VERSIONED</literal> keyword after the <literal>UPDATE</literal> keyword."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:174
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:162
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"String hqlVersionedUpdate = \"update versioned Customer set name = :newName where name = :oldName\";\n"
|
||||
"int updatedEntities = s.createQuery( hqlUpdate )\n"
|
||||
" .setString( \"newName\", newName )\n"
|
||||
" .setString( \"oldName\", oldName )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"String hqlUpdate = \"update Customer c set c.name = :newName where c.name = :"
|
||||
"oldName\";\n"
|
||||
"// or String hqlUpdate = \"update Customer set name = :newName where name = :"
|
||||
"oldName\";\n"
|
||||
"int updatedEntities = s.createQuery( hqlUpdate )\n"
|
||||
" .setString( \"newName\", newName )\n"
|
||||
" .setString( \"oldName\", oldName )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:176
|
||||
msgid "Note that custom version types (<literal>org.hibernate.usertype.UserVersionType</literal>) are not allowed in conjunction with a <literal>update versioned</literal> statement."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:181
|
||||
msgid "To execute an HQL <literal>DELETE</literal>, use the same <literal>Query.executeUpdate()</literal> method:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:186
|
||||
#. Tag: para
|
||||
#: batch.xml:164
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"String hqlDelete = \"delete Customer c where c.name = :oldName\";\n"
|
||||
"// or String hqlDelete = \"delete Customer where name = :oldName\";\n"
|
||||
"int deletedEntities = s.createQuery( hqlDelete )\n"
|
||||
" .setString( \"oldName\", oldName )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"HQL <literal>UPDATE</literal> statements, by default do not effect the <link "
|
||||
"linkend=\"mapping-declaration-version\">version</link> or the <link linkend="
|
||||
"\"mapping-declaration-timestamp\">timestamp</link> property values for the "
|
||||
"affected entities; this is in keeping with the EJB3 specification. However, "
|
||||
"you can force Hibernate to properly reset the <literal>version</literal> or "
|
||||
"<literal>timestamp</literal> property values through the use of a "
|
||||
"<literal>versioned update</literal>. This is achieved by adding the "
|
||||
"<literal>VERSIONED</literal> keyword after the <literal>UPDATE</literal> "
|
||||
"keyword."
|
||||
msgstr ""
|
||||
"HQL <literal>UPDATE</literal> statements, by default do not effect the <xref "
|
||||
"linkend=\"mapping-declaration-version\">version</xref> or the <xref linkend="
|
||||
"\"mapping-declaration-timestamp\">timestamp</xref> property values for the "
|
||||
"affected entities; this is in keeping with the EJB3 specification. However, "
|
||||
"you can force Hibernate to properly reset the <literal>version</literal> or "
|
||||
"<literal>timestamp</literal> property values through the use of a "
|
||||
"<literal>versioned update</literal>. This is achieved by adding the "
|
||||
"<literal>VERSIONED</literal> keyword after the <literal>UPDATE</literal> "
|
||||
"keyword."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:174
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"String hqlVersionedUpdate = \"update versioned Customer set name = :newName "
|
||||
"where name = :oldName\";\n"
|
||||
"int updatedEntities = s.createQuery( hqlUpdate )\n"
|
||||
" .setString( \"newName\", newName )\n"
|
||||
" .setString( \"oldName\", oldName )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:188
|
||||
msgid "The <literal>int</literal> value returned by the <literal>Query.executeUpdate()</literal> method indicate the number of entities effected by the operation. Consider this may or may not correlate to the number of rows effected in the database. An HQL bulk operation might result in multiple actual SQL statements being executed, for joined-subclass, for example. The returned number indicates the number of actual entities affected by the statement. Going back to the example of joined-subclass, a delete against one of the subclasses may actually result in deletes against not just the table to which that subclass is mapped, but also the \"root\" table and potentially joined-subclass tables further down the inheritence hierarchy."
|
||||
#. Tag: para
|
||||
#: batch.xml:176
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note that custom version types (<literal>org.hibernate.usertype."
|
||||
"UserVersionType</literal>) are not allowed in conjunction with a "
|
||||
"<literal>update versioned</literal> statement."
|
||||
msgstr ""
|
||||
"Note that custom version types (<literal>org.hibernate.usertype."
|
||||
"UserVersionType</literal>) are not allowed in conjunction with a "
|
||||
"<literal>update versioned</literal> statement."
|
||||
|
||||
#. Tag: para
|
||||
#: batch.xml:181
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"To execute an HQL <literal>DELETE</literal>, use the same <literal>Query."
|
||||
"executeUpdate()</literal> method:"
|
||||
msgstr ""
|
||||
"Para executar um HQL <literal>DELETE</literal>, use o mesmo método "
|
||||
"<literal>Query.executeUpdate()</literal>:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:186
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"String hqlDelete = \"delete Customer c where c.name = :oldName\";\n"
|
||||
"// or String hqlDelete = \"delete Customer where name = :oldName\";\n"
|
||||
"int deletedEntities = s.createQuery( hqlDelete )\n"
|
||||
" .setString( \"oldName\", oldName )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:199
|
||||
msgid "The pseudo-syntax for <literal>INSERT</literal> statements is: <literal>INSERT INTO EntityName properties_list select_statement</literal>. Some points to note:"
|
||||
#. Tag: para
|
||||
#: batch.xml:188
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The <literal>int</literal> value returned by the <literal>Query.executeUpdate"
|
||||
"()</literal> method indicate the number of entities effected by the "
|
||||
"operation. Consider this may or may not correlate to the number of rows "
|
||||
"effected in the database. An HQL bulk operation might result in multiple "
|
||||
"actual SQL statements being executed, for joined-subclass, for example. The "
|
||||
"returned number indicates the number of actual entities affected by the "
|
||||
"statement. Going back to the example of joined-subclass, a delete against "
|
||||
"one of the subclasses may actually result in deletes against not just the "
|
||||
"table to which that subclass is mapped, but also the \"root\" table and "
|
||||
"potentially joined-subclass tables further down the inheritence hierarchy."
|
||||
msgstr ""
|
||||
"O valor <literal>int</literal> retornado pelo método <literal>Query."
|
||||
"executeUpdate()</literal> indica o numero de entidade afetadas pela "
|
||||
"operação. Lembre-se que isso pode estar ou não relacionado ao número de "
|
||||
"linhas alteradas no banco de dados. Uma operação bulk HQL pode resultar em "
|
||||
"várias expressões SQL reais a serem executadas, por exemplo, no caso de "
|
||||
"joined-subclass. O número retornado indica a quantidade real de entidades "
|
||||
"afetadas pela expressão. Voltando ao exemplo da joined-subclass, a exclusão "
|
||||
"de uma das subclasses pode resultar numa exclusão em outra tabelas, não "
|
||||
"apenas na tabela para qual a subclasses está mapeada, mas também tabela "
|
||||
"\"root\" e possivelmente nas tabelas joined-subclass num nível hierárquico "
|
||||
"imediatamente abaixo."
|
||||
|
||||
#: index.docbook:207
|
||||
msgid "Only the INSERT INTO ... SELECT ... form is supported; not the INSERT INTO ... VALUES ... form."
|
||||
#. Tag: para
|
||||
#: batch.xml:199
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The pseudo-syntax for <literal>INSERT</literal> statements is: "
|
||||
"<literal>INSERT INTO EntityName properties_list select_statement</literal>. "
|
||||
"Some points to note:"
|
||||
msgstr ""
|
||||
"A pseudo-sintaxe para o comando <literal>INSERT</literal> é: <literal>INSERT "
|
||||
"INTO EntityName properties_list select_statement</literal>. Alguns pontos a "
|
||||
"observar:"
|
||||
|
||||
#: index.docbook:210
|
||||
msgid "The properties_list is analogous to the <literal>column speficiation</literal> in the SQL <literal>INSERT</literal> statement. For entities involved in mapped inheritence, only properties directly defined on that given class-level can be used in the properties_list. Superclass properties are not allowed; and subclass properties do not make sense. In other words, <literal>INSERT</literal> statements are inherently non-polymorphic."
|
||||
#. Tag: para
|
||||
#: batch.xml:207
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Only the INSERT INTO ... SELECT ... form is supported; not the INSERT "
|
||||
"INTO ... VALUES ... form."
|
||||
msgstr ""
|
||||
"Apenas a forma INSERT INTO ... SELECT ... é suportada; INSERT INTO ... "
|
||||
"VALUES ... não é suportada."
|
||||
|
||||
#: index.docbook:220
|
||||
msgid "select_statement can be any valid HQL select query, with the caveat that the return types must match the types expected by the insert. Currently, this is checked during query compilation rather than allowing the check to relegate to the database. Note however that this might cause problems between Hibernate <literal>Type</literal>s which are <emphasis>equivalent</emphasis> as opposed to <emphasis>equal</emphasis>. This might cause issues with mismatches between a property defined as a <literal>org.hibernate.type.DateType</literal> and a property defined as a <literal>org.hibernate.type.TimestampType</literal>, even though the database might not make a distinction or might be able to handle the conversion."
|
||||
#. Tag: para
|
||||
#: batch.xml:210
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The properties_list is analogous to the <literal>column speficiation</"
|
||||
"literal> in the SQL <literal>INSERT</literal> statement. For entities "
|
||||
"involved in mapped inheritence, only properties directly defined on that "
|
||||
"given class-level can be used in the properties_list. Superclass properties "
|
||||
"are not allowed; and subclass properties do not make sense. In other words, "
|
||||
"<literal>INSERT</literal> statements are inherently non-polymorphic."
|
||||
msgstr ""
|
||||
"A lista de propriedade é análoga à <literal>especificação da coluna</"
|
||||
"literal> do comando SQL <literal>INSERT</literal>. Para entidades envolvidas "
|
||||
"em mapeamentos, apenas a propriedades definidas diretamente a nível da "
|
||||
"classe podem ser usandas na properties_list. Propriedades da superclass não "
|
||||
"são permitidas; e as propriedades da subclasse não faz sentido. Em outras "
|
||||
"palavras, os comandos <literal>INSERT</literal> não são polimorficos."
|
||||
|
||||
#: index.docbook:232
|
||||
msgid "For the id property, the insert statement gives you two options. You can either explicitly specify the id property in the properties_list (in which case its value is taken from the corresponding select expression) or omit it from the properties_list (in which case a generated value is used). This later option is only available when using id generators that operate in the database; attempting to use this option with any \"in memory\" type generators will cause an exception during parsing. Note that for the purposes of this discussion, in-database generators are considered to be <literal>org.hibernate.id.SequenceGenerator</literal> (and its subclasses) and any implementors of <literal>org.hibernate.id.PostInsertIdentifierGenerator</literal>. The most notable exception here is <literal>org.hibernate.id.TableHiLoGenerator</literal>, which cannot be used because it does not expose a selectable way to get its values."
|
||||
#. Tag: para
|
||||
#: batch.xml:220
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"select_statement can be any valid HQL select query, with the caveat that the "
|
||||
"return types must match the types expected by the insert. Currently, this is "
|
||||
"checked during query compilation rather than allowing the check to relegate "
|
||||
"to the database. Note however that this might cause problems between "
|
||||
"Hibernate <literal>Type</literal>s which are <emphasis>equivalent</emphasis> "
|
||||
"as opposed to <emphasis>equal</emphasis>. This might cause issues with "
|
||||
"mismatches between a property defined as a <literal>org.hibernate.type."
|
||||
"DateType</literal> and a property defined as a <literal>org.hibernate.type."
|
||||
"TimestampType</literal>, even though the database might not make a "
|
||||
"distinction or might be able to handle the conversion."
|
||||
msgstr ""
|
||||
"O camando select pode ser qualquer query HQL válida, que tenha um retorno "
|
||||
"compatível com o tipo com o esperado pela inclusão. Atualmente, isto é "
|
||||
"verificado durante a compilação da query, isto é melhor do que permitir que "
|
||||
"a verificação chegue ao banco de dados. Entretanto perceba que isso pode "
|
||||
"causar problemas entre os <literal>Tipo</literal> do Hibernate que são "
|
||||
"<emphasis>equivalentes</emphasis> em oposição a <emphasis>equal</emphasis>. "
|
||||
"Isso pode causar problemas nas combinações entre a propriedade definida como "
|
||||
"<literal>org.hibernate.type.DateType</literal>e um propriedade definida como "
|
||||
"<literal>org.hibernate.type.TimestampType</literal>, embora o banco de dados "
|
||||
"não possa fazer uma distinção ou possa ser capaz de manusear a conversão."
|
||||
|
||||
#: index.docbook:247
|
||||
msgid "For properties mapped as either <literal>version</literal> or <literal>timestamp</literal>, the insert statement gives you two options. You can either specify the property in the properties_list (in which case its value is taken from the corresponding select expressions) or omit it from the properties_list (in which case the <literal>seed value</literal> defined by the <literal>org.hibernate.type.VersionType</literal> is used)."
|
||||
#. Tag: para
|
||||
#: batch.xml:232
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"For the id property, the insert statement gives you two options. You can "
|
||||
"either explicitly specify the id property in the properties_list (in which "
|
||||
"case its value is taken from the corresponding select expression) or omit it "
|
||||
"from the properties_list (in which case a generated value is used). This "
|
||||
"later option is only available when using id generators that operate in the "
|
||||
"database; attempting to use this option with any \"in memory\" type "
|
||||
"generators will cause an exception during parsing. Note that for the "
|
||||
"purposes of this discussion, in-database generators are considered to be "
|
||||
"<literal>org.hibernate.id.SequenceGenerator</literal> (and its subclasses) "
|
||||
"and any implementors of <literal>org.hibernate.id."
|
||||
"PostInsertIdentifierGenerator</literal>. The most notable exception here is "
|
||||
"<literal>org.hibernate.id.TableHiLoGenerator</literal>, which cannot be used "
|
||||
"because it does not expose a selectable way to get its values."
|
||||
msgstr ""
|
||||
"Para a propriedade id, a expressão insert oferece duas opções. Você pode "
|
||||
"especificar qualquer propriedade id explicitamente no properties_list (em "
|
||||
"alguns casos esse valor é obtido diretamente da expressão select) ou pode "
|
||||
"omitir do properties_list (nesse caso, um valor gerado é usado). Essa ultima "
|
||||
"opção só é válida quando são usados geradores de ids que operam no banco de "
|
||||
"dados; a tentativa de usar essa opção com geradores do tipo \"em memória\" "
|
||||
"vai causar um exceção durante a etapa de parser. Veja a finalidades desta "
|
||||
"discussão, os seguintes geradores operam com o banco de dados <literal>org."
|
||||
"hibernate.id.SequenceGenerator</literal> (e suas subclasses) e qualquer "
|
||||
"implementação de <literal>org.hibernate.id.PostInsertIdentifierGenerator</"
|
||||
"literal>. Aqui, a exceção mais notável é o <literal>org.hibernate.id."
|
||||
"TableHiLoGenerator</literal>, que não pode ser usado porque ele não dispõe "
|
||||
"de mecanismos para recuperar o seu valor."
|
||||
|
||||
#: index.docbook:257
|
||||
#. Tag: para
|
||||
#: batch.xml:247
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"For properties mapped as either <literal>version</literal> or "
|
||||
"<literal>timestamp</literal>, the insert statement gives you two options. "
|
||||
"You can either specify the property in the properties_list (in which case "
|
||||
"its value is taken from the corresponding select expressions) or omit it "
|
||||
"from the properties_list (in which case the <literal>seed value</literal> "
|
||||
"defined by the <literal>org.hibernate.type.VersionType</literal> is used)."
|
||||
msgstr ""
|
||||
"For properties mapped as either <literal>version</literal> or "
|
||||
"<literal>timestamp</literal>, the insert statement gives you two options. "
|
||||
"You can either specify the property in the properties_list (in which case "
|
||||
"its value is taken from the corresponding select expressions) or omit it "
|
||||
"from the properties_list (in which case the <literal>seed value</literal> "
|
||||
"defined by the <literal>org.hibernate.type.VersionType</literal> is used). "
|
||||
"Para propriedades mapeadas como <literal>version</literal> ou "
|
||||
"<literal>timestamp</literal>, a expressão insert oferece a você duas opções. "
|
||||
"Você pode especificar a propriedade na properties_list (nesse caso o seu "
|
||||
"valor é obtido a partir da expressão select correspondente) ou ele pode ser "
|
||||
"omitido da properties_list (neste caso o usa o <literal>valor semente</"
|
||||
"literal> definido pela classe <literal>org.hibernate.type.VersionType</"
|
||||
"literal>)."
|
||||
|
||||
#. Tag: para
|
||||
#: batch.xml:257
|
||||
#, no-c-format
|
||||
msgid "An example HQL <literal>INSERT</literal> statement execution:"
|
||||
msgstr ""
|
||||
msgstr "Exemplo da execução de um HQL <literal>INSERT</literal>:"
|
||||
|
||||
#: index.docbook:261
|
||||
#. Tag: programlisting
|
||||
#: batch.xml:261
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"String hqlInsert = \"insert into DelinquentAccount (id, name) select c.id, c.name from Customer c where ...\";\n"
|
||||
"int createdEntities = s.createQuery( hqlInsert )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"<![CDATA[Session session = sessionFactory.openSession();\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"String hqlInsert = \"insert into DelinquentAccount (id, name) select c.id, c."
|
||||
"name from Customer c where ...\";\n"
|
||||
"int createdEntities = s.createQuery( hqlInsert )\n"
|
||||
" .executeUpdate();\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
|
|
|
@ -1,168 +1,454 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: best_practices.xml:5
|
||||
#, no-c-format
|
||||
msgid "Best Practices"
|
||||
msgstr ""
|
||||
msgstr "Boas práticas"
|
||||
|
||||
#: index.docbook:9
|
||||
msgid "Write fine-grained classes and map them using <literal><component></literal>."
|
||||
#. Tag: term
|
||||
#: best_practices.xml:9
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Write fine-grained classes and map them using <literal><component></"
|
||||
"literal>."
|
||||
msgstr ""
|
||||
"Escreva classes compactas e mapeie-as usando <literal><component></"
|
||||
"literal>."
|
||||
|
||||
#: index.docbook:11
|
||||
msgid "Use an <literal>Address</literal> class to encapsulate <literal>street</literal>, <literal>suburb</literal>, <literal>state</literal>, <literal>postcode</literal>. This encourages code reuse and simplifies refactoring."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:11
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Use an <literal>Address</literal> class to encapsulate <literal>street</"
|
||||
"literal>, <literal>suburb</literal>, <literal>state</literal>, "
|
||||
"<literal>postcode</literal>. This encourages code reuse and simplifies "
|
||||
"refactoring."
|
||||
msgstr ""
|
||||
"Use uma classe <literal>Endereco</literal> para encapsular <literal>rua</"
|
||||
"literal>, <literal>bairro</literal>, <literal>estado</literal>, "
|
||||
"<literal>CEP</literal>. Isto promove a reutilização de código e simplifica o "
|
||||
"refactoring."
|
||||
|
||||
#: index.docbook:19
|
||||
#. Tag: term
|
||||
#: best_practices.xml:19
|
||||
#, no-c-format
|
||||
msgid "Declare identifier properties on persistent classes."
|
||||
msgstr ""
|
||||
msgstr "Declare propriedades identificadoras em classes persistentes."
|
||||
|
||||
#: index.docbook:21
|
||||
msgid "Hibernate makes identifier properties optional. There are all sorts of reasons why you should use them. We recommend that identifiers be 'synthetic' (generated, with no business meaning)."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:21
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate makes identifier properties optional. There are all sorts of "
|
||||
"reasons why you should use them. We recommend that identifiers be "
|
||||
"'synthetic' (generated, with no business meaning)."
|
||||
msgstr ""
|
||||
"O Hibernate constrói propriedades identificadoras opcionais. Existem todos "
|
||||
"os tipos de razões que explicam porquê você deveria utilizá-las. Nós "
|
||||
"recomendamos que os identificadores sejam 'sintéticos' (gerados, sem "
|
||||
"significado para o negocio)."
|
||||
|
||||
#: index.docbook:29
|
||||
#. Tag: term
|
||||
#: best_practices.xml:29
|
||||
#, no-c-format
|
||||
msgid "Identify natural keys."
|
||||
msgstr ""
|
||||
msgstr "Identifique chaves naturais."
|
||||
|
||||
#: index.docbook:31
|
||||
msgid "Identify natural keys for all entities, and map them using <literal><natural-id></literal>. Implement <literal>equals()</literal> and <literal>hashCode()</literal> to compare the properties that make up the natural key."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:31
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Identify natural keys for all entities, and map them using <literal><"
|
||||
"natural-id></literal>. Implement <literal>equals()</literal> and "
|
||||
"<literal>hashCode()</literal> to compare the properties that make up the "
|
||||
"natural key."
|
||||
msgstr ""
|
||||
"Identifique chaves naturais para todas as entidades, e mapeie-as usando "
|
||||
"<literal><natural-id></literal>. Implemente <literal>equals()</"
|
||||
"literal> e <literal>hashCode()</literal> para comparar as propriedades que "
|
||||
"compõem a chave natural."
|
||||
|
||||
#: index.docbook:39
|
||||
#. Tag: term
|
||||
#: best_practices.xml:39
|
||||
#, no-c-format
|
||||
msgid "Place each class mapping in its own file."
|
||||
msgstr ""
|
||||
msgstr "Coloque cada classe de mapeamento em seu próprio arquivo."
|
||||
|
||||
#: index.docbook:41
|
||||
msgid "Don't use a single monolithic mapping document. Map <literal>com.eg.Foo</literal> in the file <literal>com/eg/Foo.hbm.xml</literal>. This makes particularly good sense in a team environment."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:41
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Don't use a single monolithic mapping document. Map <literal>com.eg.Foo</"
|
||||
"literal> in the file <literal>com/eg/Foo.hbm.xml</literal>. This makes "
|
||||
"particularly good sense in a team environment."
|
||||
msgstr ""
|
||||
"Não use um único código de mapeamento monolítico. Mapeie <literal>com.eg."
|
||||
"Foo</literal> no arquivo <literal>com/eg/Foo.hbm.xml</literal>. Isto promove "
|
||||
"particularmente o bom senso no time de desenvolvimento."
|
||||
|
||||
#: index.docbook:49
|
||||
#. Tag: term
|
||||
#: best_practices.xml:49
|
||||
#, no-c-format
|
||||
msgid "Load mappings as resources."
|
||||
msgstr ""
|
||||
msgstr "Carregue os mapeamentos como recursos."
|
||||
|
||||
#: index.docbook:51
|
||||
#. Tag: para
|
||||
#: best_practices.xml:51
|
||||
#, no-c-format
|
||||
msgid "Deploy the mappings along with the classes they map."
|
||||
msgstr ""
|
||||
msgstr "Faça o deploy dos mapeamentos junto com as classes que eles mapeiam."
|
||||
|
||||
#: index.docbook:57
|
||||
#. Tag: term
|
||||
#: best_practices.xml:57
|
||||
#, no-c-format
|
||||
msgid "Consider externalising query strings."
|
||||
msgstr ""
|
||||
msgstr "Considere externalizar as strings de consultas."
|
||||
|
||||
#: index.docbook:59
|
||||
msgid "This is a good practice if your queries call non-ANSI-standard SQL functions. Externalising the query strings to mapping files will make the application more portable."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:59
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This is a good practice if your queries call non-ANSI-standard SQL "
|
||||
"functions. Externalising the query strings to mapping files will make the "
|
||||
"application more portable."
|
||||
msgstr ""
|
||||
"Esta é uma boa prática se suas consultas chamam funções SQL que não sejam "
|
||||
"ANSI. Externalizar as strings de consultas para mapear arquivos irão tornar "
|
||||
"a aplicação mais portável."
|
||||
|
||||
#: index.docbook:67
|
||||
#. Tag: term
|
||||
#: best_practices.xml:67
|
||||
#, no-c-format
|
||||
msgid "Use bind variables."
|
||||
msgstr ""
|
||||
msgstr "Use bind variables."
|
||||
|
||||
#: index.docbook:69
|
||||
msgid "As in JDBC, always replace non-constant values by \"?\". Never use string manipulation to bind a non-constant value in a query! Even better, consider using named parameters in queries."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:69
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"As in JDBC, always replace non-constant values by \"?\". Never use string "
|
||||
"manipulation to bind a non-constant value in a query! Even better, consider "
|
||||
"using named parameters in queries."
|
||||
msgstr ""
|
||||
"Assim como em JDBC, sempre substitua valores não constantes por \"?\". Nunca "
|
||||
"use a manipulação de strings para concatenar valores não constantes em uma "
|
||||
"consulta! Até melhor, considere usar parâmetros nomeados nas consultas."
|
||||
|
||||
#: index.docbook:77
|
||||
#. Tag: term
|
||||
#: best_practices.xml:77
|
||||
#, no-c-format
|
||||
msgid "Don't manage your own JDBC connections."
|
||||
msgstr ""
|
||||
msgstr "Não gerencie suas conexões JDBC."
|
||||
|
||||
#: index.docbook:79
|
||||
msgid "Hibernate lets the application manage JDBC connections. This approach should be considered a last-resort. If you can't use the built-in connections providers, consider providing your own implementation of <literal>org.hibernate.connection.ConnectionProvider</literal>."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:79
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate lets the application manage JDBC connections. This approach should "
|
||||
"be considered a last-resort. If you can't use the built-in connections "
|
||||
"providers, consider providing your own implementation of <literal>org."
|
||||
"hibernate.connection.ConnectionProvider</literal>."
|
||||
msgstr ""
|
||||
"O Hibernate permite que a aplicação gerencie conexões JDBC. Esta abordagem "
|
||||
"deve ser considerada um último recurso. Se você não pode usar os provedores "
|
||||
"de conexão embutidos, considere fazer sua implementação a partir de "
|
||||
"<literal>org.hibernate.connection.ConnectionProvider</literal>."
|
||||
|
||||
#: index.docbook:87
|
||||
#. Tag: term
|
||||
#: best_practices.xml:87
|
||||
#, no-c-format
|
||||
msgid "Consider using a custom type."
|
||||
msgstr ""
|
||||
msgstr "Considere usar tipos customizados."
|
||||
|
||||
#: index.docbook:89
|
||||
msgid "Suppose you have a Java type, say from some library, that needs to be persisted but doesn't provide the accessors needed to map it as a component. You should consider implementing <literal>org.hibernate.UserType</literal>. This approach frees the application code from implementing transformations to / from a Hibernate type."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:89
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Suppose you have a Java type, say from some library, that needs to be "
|
||||
"persisted but doesn't provide the accessors needed to map it as a component. "
|
||||
"You should consider implementing <literal>org.hibernate.UserType</literal>. "
|
||||
"This approach frees the application code from implementing transformations "
|
||||
"to / from a Hibernate type."
|
||||
msgstr ""
|
||||
"Suponha que você tenha um tipo Java, de alguma biblioteca, que precisa ser "
|
||||
"persistido mas não provê os acessórios necessários para mapeá-lo como um "
|
||||
"componente. Você deve implementar <literal>org.hibernate.UserType</literal>. "
|
||||
"Esta abordagem livra o código da aplicação de implementar transformações de/"
|
||||
"para o tipo Hibernate."
|
||||
|
||||
#: index.docbook:98
|
||||
#. Tag: term
|
||||
#: best_practices.xml:98
|
||||
#, no-c-format
|
||||
msgid "Use hand-coded JDBC in bottlenecks."
|
||||
msgstr ""
|
||||
msgstr "Use código manual JDBC nos gargalos."
|
||||
|
||||
#: index.docbook:100
|
||||
msgid "In performance-critical areas of the system, some kinds of operations might benefit from direct JDBC. But please, wait until you <emphasis>know</emphasis> something is a bottleneck. And don't assume that direct JDBC is necessarily faster. If you need to use direct JDBC, it might be worth opening a Hibernate <literal>Session</literal> and using that JDBC connection. That way you can still use the same transaction strategy and underlying connection provider."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:100
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"In performance-critical areas of the system, some kinds of operations might "
|
||||
"benefit from direct JDBC. But please, wait until you <emphasis>know</"
|
||||
"emphasis> something is a bottleneck. And don't assume that direct JDBC is "
|
||||
"necessarily faster. If you need to use direct JDBC, it might be worth "
|
||||
"opening a Hibernate <literal>Session</literal> and using that JDBC "
|
||||
"connection. That way you can still use the same transaction strategy and "
|
||||
"underlying connection provider."
|
||||
msgstr ""
|
||||
"Nas áreas de desempenho crítico do sistema, alguns tipos de operações podem "
|
||||
"se beneficiar do uso direto do JDBC. Mas por favor, espere até você "
|
||||
"<emphasis>saber </emphasis> se é um gargalo. E não suponha que o uso direto "
|
||||
"do JDBC é necessariamente mais rápido. Se você precisar usar diretamente o "
|
||||
"JDBC, vale a pena abrir uma <literal>Session</literal> do Hibernate e usar "
|
||||
"uma conexão JDBC. De modo que você possa ainda usar a mesma estratégia de "
|
||||
"transação e ocultar o provedor a conexão"
|
||||
|
||||
#: index.docbook:110
|
||||
#. Tag: term
|
||||
#: best_practices.xml:110
|
||||
#, no-c-format
|
||||
msgid "Understand <literal>Session</literal> flushing."
|
||||
msgstr ""
|
||||
msgstr "Entenda o <literal>Session</literal> flushing."
|
||||
|
||||
#: index.docbook:112
|
||||
msgid "From time to time the Session synchronizes its persistent state with the database. Performance will be affected if this process occurs too often. You may sometimes minimize unnecessary flushing by disabling automatic flushing or even by changing the order of queries and other operations within a particular transaction."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:112
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"From time to time the Session synchronizes its persistent state with the "
|
||||
"database. Performance will be affected if this process occurs too often. You "
|
||||
"may sometimes minimize unnecessary flushing by disabling automatic flushing "
|
||||
"or even by changing the order of queries and other operations within a "
|
||||
"particular transaction."
|
||||
msgstr ""
|
||||
"De tempos em tempos a sessão sincroniza seu estado persistente com o banco "
|
||||
"de dados. O desempenho será afetado se este processo ocorrer frequentemente. "
|
||||
"Você pode algumas vezes minimizar o fluxo desnecessário desabilitando o "
|
||||
"fluxo automático ou até mesmo mudando a ordem das consultas e outras "
|
||||
"operações em uma transação particular."
|
||||
|
||||
#: index.docbook:121
|
||||
#. Tag: term
|
||||
#: best_practices.xml:121
|
||||
#, no-c-format
|
||||
msgid "In a three tiered architecture, consider using detached objects."
|
||||
msgstr ""
|
||||
"Em uma arquitetura de três camadas, considere o uso de objetos separados."
|
||||
|
||||
#: index.docbook:123
|
||||
msgid "When using a servlet / session bean architecture, you could pass persistent objects loaded in the session bean to and from the servlet / JSP layer. Use a new session to service each request. Use <literal>Session.merge()</literal> or <literal>Session.saveOrUpdate()</literal> to synchronize objects with the database."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:123
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"When using a servlet / session bean architecture, you could pass persistent "
|
||||
"objects loaded in the session bean to and from the servlet / JSP layer. Use "
|
||||
"a new session to service each request. Use <literal>Session.merge()</"
|
||||
"literal> or <literal>Session.saveOrUpdate()</literal> to synchronize objects "
|
||||
"with the database."
|
||||
msgstr ""
|
||||
"When using a servlet / session bean architecture, you could pass persistent "
|
||||
"objects loaded in the session bean to and from the servlet / JSP layer. Use "
|
||||
"a new session to service each request. Use <literal>Session.merge()</"
|
||||
"literal> or <literal>Session.saveOrUpdate()</literal> to synchronize objects "
|
||||
"with the database."
|
||||
|
||||
#: index.docbook:132
|
||||
#. Tag: term
|
||||
#: best_practices.xml:132
|
||||
#, no-c-format
|
||||
msgid "In a two tiered architecture, consider using long persistence contexts."
|
||||
msgstr ""
|
||||
"In a two tiered architecture, consider using long persistence contexts."
|
||||
|
||||
#: index.docbook:134
|
||||
msgid "Database Transactions have to be as short as possible for best scalability. However, it is often neccessary to implement long running <emphasis>application transactions</emphasis>, a single unit-of-work from the point of view of a user. An application transaction might span several client request/response cycles. It is common to use detached objects to implement application transactions. An alternative, extremely appropriate in two tiered architecture, is to maintain a single open persistence contact (session) for the whole life cycle of the application transaction and simply disconnect from the JDBC connection at the end of each request and reconnect at the beginning of the subsequent request. Never share a single session across more than one application transaction, or you will be working with stale data."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:134
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Database Transactions have to be as short as possible for best scalability. "
|
||||
"However, it is often neccessary to implement long running "
|
||||
"<emphasis>application transactions</emphasis>, a single unit-of-work from "
|
||||
"the point of view of a user. An application transaction might span several "
|
||||
"client request/response cycles. It is common to use detached objects to "
|
||||
"implement application transactions. An alternative, extremely appropriate in "
|
||||
"two tiered architecture, is to maintain a single open persistence contact "
|
||||
"(session) for the whole life cycle of the application transaction and simply "
|
||||
"disconnect from the JDBC connection at the end of each request and reconnect "
|
||||
"at the beginning of the subsequent request. Never share a single session "
|
||||
"across more than one application transaction, or you will be working with "
|
||||
"stale data."
|
||||
msgstr ""
|
||||
"Database Transactions have to be as short as possible for best scalability. "
|
||||
"However, it is often necessary to implement long running "
|
||||
"<emphasis>application transactions</emphasis>, a single unit-of-work from "
|
||||
"the point of view of a user. An application transaction might span several "
|
||||
"client request/response cycles. It is common to use detached objects to "
|
||||
"implement application transactions. An alternative, extremely appropriate in "
|
||||
"two tiered architecture, is to maintain a single open persistence contact "
|
||||
"(session) for the whole life cycle of the application transaction and simply "
|
||||
"disconnect from the JDBC connection at the end of each request and reconnect "
|
||||
"at the beginning of the subsequent request. Never share a single session "
|
||||
"across more than one application transaction, or you will be working with "
|
||||
"stale data."
|
||||
|
||||
#: index.docbook:148
|
||||
#. Tag: term
|
||||
#: best_practices.xml:148
|
||||
#, no-c-format
|
||||
msgid "Don't treat exceptions as recoverable."
|
||||
msgstr ""
|
||||
msgstr "Don't treat exceptions as recoverable."
|
||||
|
||||
#: index.docbook:150
|
||||
msgid "This is more of a necessary practice than a \"best\" practice. When an exception occurs, roll back the <literal>Transaction</literal> and close the <literal>Session</literal>. If you don't, Hibernate can't guarantee that in-memory state accurately represents persistent state. As a special case of this, do not use <literal>Session.load()</literal> to determine if an instance with the given identifier exists on the database; use <literal>Session.get()</literal> or a query instead."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:150
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This is more of a necessary practice than a \"best\" practice. When an "
|
||||
"exception occurs, roll back the <literal>Transaction</literal> and close the "
|
||||
"<literal>Session</literal>. If you don't, Hibernate can't guarantee that in-"
|
||||
"memory state accurately represents persistent state. As a special case of "
|
||||
"this, do not use <literal>Session.load()</literal> to determine if an "
|
||||
"instance with the given identifier exists on the database; use "
|
||||
"<literal>Session.get()</literal> or a query instead."
|
||||
msgstr ""
|
||||
"This is more of a necessary practice than a \"best\" practice. When an "
|
||||
"exception occurs, roll back the <literal>Transaction</literal> and close the "
|
||||
"<literal>Session</literal>. If you don't, Hibernate can't guarantee that in-"
|
||||
"memory state accurately represents persistent state. As a special case of "
|
||||
"this, do not use <literal>Session.load()</literal> to determine if an "
|
||||
"instance with the given identifier exists on the database; use "
|
||||
"<literal>Session.get()</literal> or a query instead."
|
||||
|
||||
#: index.docbook:160
|
||||
#. Tag: term
|
||||
#: best_practices.xml:160
|
||||
#, no-c-format
|
||||
msgid "Prefer lazy fetching for associations."
|
||||
msgstr ""
|
||||
msgstr "Prefer lazy fetching for associations."
|
||||
|
||||
#: index.docbook:162
|
||||
msgid "Use eager fetching sparingly. Use proxies and lazy collections for most associations to classes that are not likely to be completely held in the second-level cache. For associations to cached classes, where there is an a extremely high probability of a cache hit, explicitly disable eager fetching using <literal>lazy=\"false\"</literal>. When an join fetching is appropriate to a particular use case, use a query with a <literal>left join fetch</literal>."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:162
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Use eager fetching sparingly. Use proxies and lazy collections for most "
|
||||
"associations to classes that are not likely to be completely held in the "
|
||||
"second-level cache. For associations to cached classes, where there is an a "
|
||||
"extremely high probability of a cache hit, explicitly disable eager fetching "
|
||||
"using <literal>lazy=\"false\"</literal>. When an join fetching is "
|
||||
"appropriate to a particular use case, use a query with a <literal>left join "
|
||||
"fetch</literal>."
|
||||
msgstr ""
|
||||
"Use eager fetching sparingly. Use proxies and lazy collections for most "
|
||||
"associations to classes that are not likely to be completely held in the "
|
||||
"second-level cache. For associations to cached classes, where there is an a "
|
||||
"extremely high probability of a cache hit, explicitly disable eager fetching "
|
||||
"using <literal>lazy=\"false\"</literal>. When an join fetching is "
|
||||
"appropriate to a particular use case, use a query with a <literal>left join "
|
||||
"fetch</literal>."
|
||||
|
||||
#: index.docbook:172
|
||||
msgid "Use the <emphasis>open session in view</emphasis> pattern, or a disciplined <emphasis>assembly phase</emphasis> to avoid problems with unfetched data."
|
||||
#. Tag: term
|
||||
#: best_practices.xml:172
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Use the <emphasis>open session in view</emphasis> pattern, or a disciplined "
|
||||
"<emphasis>assembly phase</emphasis> to avoid problems with unfetched data."
|
||||
msgstr ""
|
||||
"Use the <emphasis>open session in view</emphasis> pattern, or a disciplined "
|
||||
"<emphasis>assembly phase</emphasis> to avoid problems with unfetched data."
|
||||
|
||||
#: index.docbook:177
|
||||
msgid "Hibernate frees the developer from writing tedious <emphasis>Data Transfer Objects</emphasis> (DTO). In a traditional EJB architecture, DTOs serve dual purposes: first, they work around the problem that entity beans are not serializable; second, they implicitly define an assembly phase where all data to be used by the view is fetched and marshalled into the DTOs before returning control to the presentation tier. Hibernate eliminates the first purpose. However, you will still need an assembly phase (think of your business methods as having a strict contract with the presentation tier about what data is available in the detached objects) unless you are prepared to hold the persistence context (the session) open across the view rendering process. This is not a limitation of Hibernate! It is a fundamental requirement of safe transactional data access."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:177
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate frees the developer from writing tedious <emphasis>Data Transfer "
|
||||
"Objects</emphasis> (DTO). In a traditional EJB architecture, DTOs serve dual "
|
||||
"purposes: first, they work around the problem that entity beans are not "
|
||||
"serializable; second, they implicitly define an assembly phase where all "
|
||||
"data to be used by the view is fetched and marshalled into the DTOs before "
|
||||
"returning control to the presentation tier. Hibernate eliminates the first "
|
||||
"purpose. However, you will still need an assembly phase (think of your "
|
||||
"business methods as having a strict contract with the presentation tier "
|
||||
"about what data is available in the detached objects) unless you are "
|
||||
"prepared to hold the persistence context (the session) open across the view "
|
||||
"rendering process. This is not a limitation of Hibernate! It is a "
|
||||
"fundamental requirement of safe transactional data access."
|
||||
msgstr ""
|
||||
"Hibernate frees the developer from writing tedious <emphasis>Data Transfer "
|
||||
"Objects</emphasis> (DTO). In a traditional EJB architecture, DTOs serve dual "
|
||||
"purposes: first, they work around the problem that entity beans are not "
|
||||
"serializable; second, they implicitly define an assembly phase where all "
|
||||
"data to be used by the view is fetched and marshalled into the DTOs before "
|
||||
"returning control to the presentation tier. Hibernate eliminates the first "
|
||||
"purpose. However, you will still need an assembly phase (think of your "
|
||||
"business methods as having a strict contract with the presentation tier "
|
||||
"about what data is available in the detached objects) unless you are "
|
||||
"prepared to hold the persistence context (the session) open across the view "
|
||||
"rendering process. This is not a limitation of Hibernate! It is a "
|
||||
"fundamental requirement of safe transactional data access."
|
||||
|
||||
#: index.docbook:191
|
||||
#. Tag: term
|
||||
#: best_practices.xml:191
|
||||
#, no-c-format
|
||||
msgid "Consider abstracting your business logic from Hibernate."
|
||||
msgstr ""
|
||||
msgstr "Consider abstracting your business logic from Hibernate."
|
||||
|
||||
#: index.docbook:193
|
||||
msgid "Hide (Hibernate) data-access code behind an interface. Combine the <emphasis>DAO</emphasis> and <emphasis>Thread Local Session</emphasis> patterns. You can even have some classes persisted by handcoded JDBC, associated to Hibernate via a <literal>UserType</literal>. (This advice is intended for \"sufficiently large\" applications; it is not appropriate for an application with five tables!)"
|
||||
#. Tag: para
|
||||
#: best_practices.xml:193
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hide (Hibernate) data-access code behind an interface. Combine the "
|
||||
"<emphasis>DAO</emphasis> and <emphasis>Thread Local Session</emphasis> "
|
||||
"patterns. You can even have some classes persisted by handcoded JDBC, "
|
||||
"associated to Hibernate via a <literal>UserType</literal>. (This advice is "
|
||||
"intended for \"sufficiently large\" applications; it is not appropriate for "
|
||||
"an application with five tables!)"
|
||||
msgstr ""
|
||||
"Hide (Hibernate) data-access code behind an interface. Combine the "
|
||||
"<emphasis>DAO</emphasis> and <emphasis>Thread Local Session</emphasis> "
|
||||
"patterns. You can even have some classes persisted by handcoded JDBC, "
|
||||
"associated to Hibernate via a <literal>UserType</literal>. (This advice is "
|
||||
"intended for \"sufficiently large\" applications; it is not appropriate for "
|
||||
"an application with five tables!)"
|
||||
|
||||
#: index.docbook:203
|
||||
#. Tag: term
|
||||
#: best_practices.xml:203
|
||||
#, no-c-format
|
||||
msgid "Don't use exotic association mappings."
|
||||
msgstr ""
|
||||
msgstr "Don't use exotic association mappings."
|
||||
|
||||
#: index.docbook:205
|
||||
msgid "Good usecases for a real many-to-many associations are rare. Most of the time you need additional information stored in the \"link table\". In this case, it is much better to use two one-to-many associations to an intermediate link class. In fact, we think that most associations are one-to-many and many-to-one, you should be careful when using any other association style and ask yourself if it is really neccessary."
|
||||
#. Tag: para
|
||||
#: best_practices.xml:205
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Good usecases for a real many-to-many associations are rare. Most of the "
|
||||
"time you need additional information stored in the \"link table\". In this "
|
||||
"case, it is much better to use two one-to-many associations to an "
|
||||
"intermediate link class. In fact, we think that most associations are one-to-"
|
||||
"many and many-to-one, you should be careful when using any other association "
|
||||
"style and ask yourself if it is really neccessary."
|
||||
msgstr ""
|
||||
"Good usecases for a real many-to-many associations are rare. Most of the "
|
||||
"time you need additional information stored in the \"link table\". In this "
|
||||
"case, it is much better to use two one-to-many associations to an "
|
||||
"intermediate link class. In fact, we think that most associations are one-to-"
|
||||
"many and many-to-one, you should be careful when using any other association "
|
||||
"style and ask yourself if it is really neccessary."
|
||||
|
||||
#: index.docbook:215
|
||||
#. Tag: term
|
||||
#: best_practices.xml:215
|
||||
#, no-c-format
|
||||
msgid "Prefer bidirectional associations."
|
||||
msgstr "Prefer bidirectional associations."
|
||||
|
||||
#. Tag: para
|
||||
#: best_practices.xml:217
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Unidirectional associations are more difficult to query. In a large "
|
||||
"application, almost all associations must be navigable in both directions in "
|
||||
"queries."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:217
|
||||
msgid "Unidirectional associations are more difficult to query. In a large application, almost all associations must be navigable in both directions in queries."
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
"Unidirectional associations are more difficult to query. In a large "
|
||||
"application, almost all associations must be navigable in both directions in "
|
||||
"queries."
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,372 +1,685 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: component_mapping.xml:5
|
||||
#, no-c-format
|
||||
msgid "Component Mapping"
|
||||
msgstr ""
|
||||
msgstr "Mapeamento de Componentes"
|
||||
|
||||
#: index.docbook:7
|
||||
msgid "The notion of a <emphasis>component</emphasis> is re-used in several different contexts, for different purposes, throughout Hibernate."
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:7
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The notion of a <emphasis>component</emphasis> is re-used in several "
|
||||
"different contexts, for different purposes, throughout Hibernate."
|
||||
msgstr ""
|
||||
"A noção de <emphasis>componente</emphasis> é reusada em vários contextos "
|
||||
"diferentes, para propósitos diferentes, pelo Hibernate."
|
||||
|
||||
#: index.docbook:13
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:13
|
||||
#, no-c-format
|
||||
msgid "Dependent objects"
|
||||
msgstr ""
|
||||
msgstr "Objetos dependentes"
|
||||
|
||||
#: index.docbook:15
|
||||
msgid "A component is a contained object that is persisted as a value type, not an entity reference. The term \"component\" refers to the object-oriented notion of composition (not to architecture-level components). For example, you might model a person like this:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:21
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:15
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class Person {\n"
|
||||
" private java.util.Date birthday;\n"
|
||||
" private Name name;\n"
|
||||
" private String key;\n"
|
||||
" public String getKey() {\n"
|
||||
" return key;\n"
|
||||
" }\n"
|
||||
" private void setKey(String key) {\n"
|
||||
" this.key=key;\n"
|
||||
" }\n"
|
||||
" public java.util.Date getBirthday() {\n"
|
||||
" return birthday;\n"
|
||||
" }\n"
|
||||
" public void setBirthday(java.util.Date birthday) {\n"
|
||||
" this.birthday = birthday;\n"
|
||||
" }\n"
|
||||
" public Name getName() {\n"
|
||||
" return name;\n"
|
||||
" }\n"
|
||||
" public void setName(Name name) {\n"
|
||||
" this.name = name;\n"
|
||||
" }\n"
|
||||
" ......\n"
|
||||
" ......\n"
|
||||
"}]]>"
|
||||
"A component is a contained object that is persisted as a value type, not an "
|
||||
"entity reference. The term \"component\" refers to the object-oriented "
|
||||
"notion of composition (not to architecture-level components). For example, "
|
||||
"you might model a person like this:"
|
||||
msgstr ""
|
||||
"Um componente é um objeto contido que é persistido como um tipo de valor, "
|
||||
"não uma referência de entidade. O termo \"componente\" refere-se à noção de "
|
||||
"composição da orientação a objetos (não a componentes no nível de "
|
||||
"arquitetura). Por exemplo, você pode modelar uma pessoa desta maneira:"
|
||||
|
||||
#: index.docbook:23
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:21
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class Name {\n"
|
||||
" char initial;\n"
|
||||
" String first;\n"
|
||||
" String last;\n"
|
||||
" public String getFirst() {\n"
|
||||
" return first;\n"
|
||||
" }\n"
|
||||
" void setFirst(String first) {\n"
|
||||
" this.first = first;\n"
|
||||
" }\n"
|
||||
" public String getLast() {\n"
|
||||
" return last;\n"
|
||||
" }\n"
|
||||
" void setLast(String last) {\n"
|
||||
" this.last = last;\n"
|
||||
" }\n"
|
||||
" public char getInitial() {\n"
|
||||
" return initial;\n"
|
||||
" }\n"
|
||||
" void setInitial(char initial) {\n"
|
||||
" this.initial = initial;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
"<![CDATA[public class Person {\n"
|
||||
" private java.util.Date birthday;\n"
|
||||
" private Name name;\n"
|
||||
" private String key;\n"
|
||||
" public String getKey() {\n"
|
||||
" return key;\n"
|
||||
" }\n"
|
||||
" private void setKey(String key) {\n"
|
||||
" this.key=key;\n"
|
||||
" }\n"
|
||||
" public java.util.Date getBirthday() {\n"
|
||||
" return birthday;\n"
|
||||
" }\n"
|
||||
" public void setBirthday(java.util.Date birthday) {\n"
|
||||
" this.birthday = birthday;\n"
|
||||
" }\n"
|
||||
" public Name getName() {\n"
|
||||
" return name;\n"
|
||||
" }\n"
|
||||
" public void setName(Name name) {\n"
|
||||
" this.name = name;\n"
|
||||
" }\n"
|
||||
" ......\n"
|
||||
" ......\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:25
|
||||
msgid "Now <literal>Name</literal> may be persisted as a component of <literal>Person</literal>. Notice that <literal>Name</literal> defines getter and setter methods for its persistent properties, but doesn't need to declare any interfaces or identifier properties."
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:23
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class Name {\n"
|
||||
" char initial;\n"
|
||||
" String first;\n"
|
||||
" String last;\n"
|
||||
" public String getFirst() {\n"
|
||||
" return first;\n"
|
||||
" }\n"
|
||||
" void setFirst(String first) {\n"
|
||||
" this.first = first;\n"
|
||||
" }\n"
|
||||
" public String getLast() {\n"
|
||||
" return last;\n"
|
||||
" }\n"
|
||||
" void setLast(String last) {\n"
|
||||
" this.last = last;\n"
|
||||
" }\n"
|
||||
" public char getInitial() {\n"
|
||||
" return initial;\n"
|
||||
" }\n"
|
||||
" void setInitial(char initial) {\n"
|
||||
" this.initial = initial;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:32
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:25
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Now <literal>Name</literal> may be persisted as a component of "
|
||||
"<literal>Person</literal>. Notice that <literal>Name</literal> defines "
|
||||
"getter and setter methods for its persistent properties, but doesn't need to "
|
||||
"declare any interfaces or identifier properties."
|
||||
msgstr ""
|
||||
"Agora <literal>Name</literal> pode ser persistido como um componente de "
|
||||
"<literal>Person</literal>. Note que <literal>Name</literal> define métodos "
|
||||
"getter e setter para suas propriedades persistentes, mas não necessita "
|
||||
"declarar nenhuma interface ou propriedades identificadoras."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:32
|
||||
#, no-c-format
|
||||
msgid "Our Hibernate mapping would look like:"
|
||||
msgstr ""
|
||||
msgstr "Nosso mapeamento do Hibernate seria semelhante a isso"
|
||||
|
||||
#: index.docbook:36
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:36
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Person\" table=\"person\">\n"
|
||||
" <id name=\"Key\" column=\"pid\" type=\"string\">\n"
|
||||
" <generator class=\"uuid\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"birthday\" type=\"date\"/>\n"
|
||||
" <component name=\"Name\" class=\"eg.Name\"> <!-- class attribute optional -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </component>\n"
|
||||
"</class>]]>"
|
||||
"<![CDATA[<class name=\"eg.Person\" table=\"person\">\n"
|
||||
" <id name=\"Key\" column=\"pid\" type=\"string\">\n"
|
||||
" <generator class=\"uuid\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"birthday\" type=\"date\"/>\n"
|
||||
" <component name=\"Name\" class=\"eg.Name\"> <!-- class attribute "
|
||||
"optional -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </component>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:38
|
||||
msgid "The person table would have the columns <literal>pid</literal>, <literal>birthday</literal>, <literal>initial</literal>, <literal>first</literal> and <literal>last</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:46
|
||||
msgid "Like all value types, components do not support shared references. In other words, two persons could have the same name, but the two person objects would contain two independent name ojects, only \"the same\" by value. The null value semantics of a component are <emphasis>ad hoc</emphasis>. When reloading the containing object, Hibernate will assume that if all component columns are null, then the entire component is null. This should be okay for most purposes."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:55
|
||||
msgid "The properties of a component may be of any Hibernate type (collections, many-to-one associations, other components, etc). Nested components should <emphasis>not</emphasis> be considered an exotic usage. Hibernate is intended to support a very fine-grained object model."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:62
|
||||
msgid "The <literal><component></literal> element allows a <literal><parent></literal> subelement that maps a property of the component class as a reference back to the containing entity."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:68
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:38
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Person\" table=\"person\">\n"
|
||||
" <id name=\"Key\" column=\"pid\" type=\"string\">\n"
|
||||
" <generator class=\"uuid\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"birthday\" type=\"date\"/>\n"
|
||||
" <component name=\"Name\" class=\"eg.Name\" unique=\"true\">\n"
|
||||
" <parent name=\"namedPerson\"/> <!-- reference back to the Person -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </component>\n"
|
||||
"</class>]]>"
|
||||
"The person table would have the columns <literal>pid</literal>, "
|
||||
"<literal>birthday</literal>, <literal>initial</literal>, <literal>first</"
|
||||
"literal> and <literal>last</literal>."
|
||||
msgstr ""
|
||||
"A tabela pessoa teria as seguintes colunas <literal>pid</literal>, "
|
||||
"<literal>birthday</literal>, <literal>initial</literal>, <literal>first</"
|
||||
"literal> and <literal>last</literal>."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:46
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Like all value types, components do not support shared references. In other "
|
||||
"words, two persons could have the same name, but the two person objects "
|
||||
"would contain two independent name ojects, only \"the same\" by value. The "
|
||||
"null value semantics of a component are <emphasis>ad hoc</emphasis>. When "
|
||||
"reloading the containing object, Hibernate will assume that if all component "
|
||||
"columns are null, then the entire component is null. This should be okay for "
|
||||
"most purposes."
|
||||
msgstr ""
|
||||
"Assim como todos tipos por valor, componentes não suportam referencias "
|
||||
"cruzadas. Em outras palavras, duas pessoas poderiam possuir o mesmo nome, "
|
||||
"mas os dois objetos pessoa poderiam conter dois objetos nome independentes, "
|
||||
"apenas com \"o mesmo\" por valor. A semântica dos valores null de um "
|
||||
"componente são <emphasis>ad hoc</emphasis>. No recarregameno do conteúdo do "
|
||||
"objeto, O Hibernate assumira que se todas as colunas do componente são null, "
|
||||
"então todo o componente é null. Isto seria o certo para a maioria dos "
|
||||
"propósitos."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:55
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The properties of a component may be of any Hibernate type (collections, "
|
||||
"many-to-one associations, other components, etc). Nested components should "
|
||||
"<emphasis>not</emphasis> be considered an exotic usage. Hibernate is "
|
||||
"intended to support a very fine-grained object model."
|
||||
msgstr ""
|
||||
"As propriedades de um componente podem ser de qualquer tipo do Hibernate"
|
||||
"(collections, associações muitos-para-um, outros componentes, etc). "
|
||||
"Componentes agrupados <emphasis>não </emphasis> devem ser consideros um uso "
|
||||
"exótico. O Hibernate tem a intenção de suportar um modelo de objetos muito "
|
||||
"bem granulado."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:62
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The <literal><component></literal> element allows a <literal><"
|
||||
"parent></literal> subelement that maps a property of the component class "
|
||||
"as a reference back to the containing entity."
|
||||
msgstr ""
|
||||
"O elemento <literal><component></literal> permite um subelemento "
|
||||
"<literal><parent></literal> que mapeia uma propriedade da classe "
|
||||
"componente como uma referência de volta para a entidade que a contém."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:68
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Person\" table=\"person\">\n"
|
||||
" <id name=\"Key\" column=\"pid\" type=\"string\">\n"
|
||||
" <generator class=\"uuid\"/>\n"
|
||||
" </id>\n"
|
||||
" <property name=\"birthday\" type=\"date\"/>\n"
|
||||
" <component name=\"Name\" class=\"eg.Name\" unique=\"true\">\n"
|
||||
" <parent name=\"namedPerson\"/> <!-- reference back to the Person --"
|
||||
">\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </component>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:73
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:73
|
||||
#, no-c-format
|
||||
msgid "Collections of dependent objects"
|
||||
msgstr ""
|
||||
msgstr "Collections de objetos dependentes"
|
||||
|
||||
#: index.docbook:75
|
||||
msgid "Collections of components are supported (eg. an array of type <literal>Name</literal>). Declare your component collection by replacing the <literal><element></literal> tag with a <literal><composite-element></literal> tag."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:82
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:75
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"someNames\" table=\"some_names\" lazy=\"true\">\n"
|
||||
" <key column=\"id\"/>\n"
|
||||
" <composite-element class=\"eg.Name\"> <!-- class attribute required -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </composite-element>\n"
|
||||
"</set>]]>"
|
||||
"Collections of components are supported (eg. an array of type <literal>Name</"
|
||||
"literal>). Declare your component collection by replacing the <literal><"
|
||||
"element></literal> tag with a <literal><composite-element></"
|
||||
"literal> tag."
|
||||
msgstr ""
|
||||
"Collections de componentes são suportadadas(ex. uma array de tipo "
|
||||
"<literal>Name</literal>). Declare a sua collection de componentes "
|
||||
"substituindo a tag<literal><element></literal> pela tag <literal><"
|
||||
"composite-element></literal>."
|
||||
|
||||
#: index.docbook:84
|
||||
msgid "Note: if you define a <literal>Set</literal> of composite elements, it is very important to implement <literal>equals()</literal> and <literal>hashCode()</literal> correctly."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:90
|
||||
msgid "Composite elements may contain components but not collections. If your composite element itself contains components, use the <literal><nested-composite-element></literal> tag. This is a pretty exotic case - a collection of components which themselves have components. By this stage you should be asking yourself if a one-to-many association is more appropriate. Try remodelling the composite element as an entity - but note that even though the Java model is the same, the relational model and persistence semantics are still slightly different."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:102
|
||||
msgid "Please note that a composite element mapping doesn't support null-able properties if you're using a <literal><set></literal>. Hibernate has to use each columns value to identify a record when deleting objects (there is no separate primary key column in the composite element table), which is not possible with null values. You have to either use only not-null properties in a composite-element or choose a <literal><list></literal>, <literal><map></literal>, <literal><bag></literal> or <literal><idbag></literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:113
|
||||
msgid "A special case of a composite element is a composite element with a nested <literal><many-to-one></literal> element. A mapping like this allows you to map extra columns of a many-to-many association table to the composite element class. The following is a many-to-many association from <literal>Order</literal> to <literal>Item</literal> where <literal>purchaseDate</literal>, <literal>price</literal> and <literal>quantity</literal> are properties of the association:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:123
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:82
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Order\" .... >\n"
|
||||
" ....\n"
|
||||
" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"
|
||||
" <key column=\"order_id\">\n"
|
||||
" <composite-element class=\"eg.Purchase\">\n"
|
||||
" <property name=\"purchaseDate\"/>\n"
|
||||
" <property name=\"price\"/>\n"
|
||||
" <property name=\"quantity\"/>\n"
|
||||
" <many-to-one name=\"item\" class=\"eg.Item\"/> <!-- class attribute is optional -->\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
"<![CDATA[<set name=\"someNames\" table=\"some_names\" lazy=\"true\">\n"
|
||||
" <key column=\"id\"/>\n"
|
||||
" <composite-element class=\"eg.Name\"> <!-- class attribute required -->\n"
|
||||
" <property name=\"initial\"/>\n"
|
||||
" <property name=\"first\"/>\n"
|
||||
" <property name=\"last\"/>\n"
|
||||
" </composite-element>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:125
|
||||
msgid "Of course, there can't be a reference to the purchae on the other side, for bidirectional association navigation. Remember that components are value types and don't allow shared references. A single <literal>Purchase</literal> can be in the set of an <literal>Order</literal>, but it can't be referenced by the <literal>Item</literal> at the same time."
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:84
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note: if you define a <literal>Set</literal> of composite elements, it is "
|
||||
"very important to implement <literal>equals()</literal> and <literal>hashCode"
|
||||
"()</literal> correctly."
|
||||
msgstr ""
|
||||
"Nota: se você definir um <literal>Set</literal> de elementos compostos, é "
|
||||
"muito importante implementar <literal>equals()</literal> e <literal>hashCode"
|
||||
"()</literal> corretamente."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:90
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Composite elements may contain components but not collections. If your "
|
||||
"composite element itself contains components, use the <literal><nested-"
|
||||
"composite-element></literal> tag. This is a pretty exotic case - a "
|
||||
"collection of components which themselves have components. By this stage you "
|
||||
"should be asking yourself if a one-to-many association is more appropriate. "
|
||||
"Try remodelling the composite element as an entity - but note that even "
|
||||
"though the Java model is the same, the relational model and persistence "
|
||||
"semantics are still slightly different."
|
||||
msgstr ""
|
||||
"Elementos compostos podem conter componentes mas não collections. Se o seu "
|
||||
"elemento composto contiver componentes , use a tag <literal><nested-"
|
||||
"composite-element></literal> . Este é um caso bastante exótico – uma "
|
||||
"collections de componentes que por si própria possui componentes. Neste "
|
||||
"momento você deve estar se perguntando se uma associação de um-para-muitos "
|
||||
"seria mais apropriada. Tente remodelar o elemento composto como uma entidade "
|
||||
"– mas note que mesmo pensando que o modelo Java é o mesmo, o modelo "
|
||||
"relacional e a semântica de persistência ainda são diferentes."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:102
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Please note that a composite element mapping doesn't support null-able "
|
||||
"properties if you're using a <literal><set></literal>. Hibernate has "
|
||||
"to use each columns value to identify a record when deleting objects (there "
|
||||
"is no separate primary key column in the composite element table), which is "
|
||||
"not possible with null values. You have to either use only not-null "
|
||||
"properties in a composite-element or choose a <literal><list></"
|
||||
"literal>, <literal><map></literal>, <literal><bag></literal> or "
|
||||
"<literal><idbag></literal>."
|
||||
msgstr ""
|
||||
"Por favor, note que um mapeamento de elemento composto não suporta "
|
||||
"propriedades capazes de serem null se você estiver usando um <literal><"
|
||||
"set></literal>. O Hibernate tem que usar cada valor das colunas para "
|
||||
"identificar um registro quando estiver deletando objetos (não existe coluna "
|
||||
"chave primária separada na tabela de elemento composto), que não é possível "
|
||||
"com valores null. Você tem que usar um dos dois, ou apenas propriedades não "
|
||||
"null em um elemento composto ou escolher uma <literal><list></"
|
||||
"literal>, <literal><map></literal>, <literal><bag></literal> ou "
|
||||
"<literal><idbag></literal>."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:113
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A special case of a composite element is a composite element with a nested "
|
||||
"<literal><many-to-one></literal> element. A mapping like this allows "
|
||||
"you to map extra columns of a many-to-many association table to the "
|
||||
"composite element class. The following is a many-to-many association from "
|
||||
"<literal>Order</literal> to <literal>Item</literal> where "
|
||||
"<literal>purchaseDate</literal>, <literal>price</literal> and "
|
||||
"<literal>quantity</literal> are properties of the association:"
|
||||
msgstr ""
|
||||
"Um caso especial de elemento composto é um elemento composto com um elemento "
|
||||
"<literal><many-to-one></literal> aninhado. Um mapeamento como este "
|
||||
"permite você a mapear colunas extras de uma tabela de associação de muitos-"
|
||||
"para-muitos para a classe de elemento composto. A seguinte associação de "
|
||||
"muitos-para-muitos de <literal>Order</literal> para um <literal>Item</"
|
||||
"literal> onde <literal>purchaseDate</literal>, <literal>price</literal> e "
|
||||
"<literal>quantity</literal> são propriedades da associação:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:123
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Order\" .... >\n"
|
||||
" ....\n"
|
||||
" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"
|
||||
" <key column=\"order_id\">\n"
|
||||
" <composite-element class=\"eg.Purchase\">\n"
|
||||
" <property name=\"purchaseDate\"/>\n"
|
||||
" <property name=\"price\"/>\n"
|
||||
" <property name=\"quantity\"/>\n"
|
||||
" <many-to-one name=\"item\" class=\"eg.Item\"/> <!-- class "
|
||||
"attribute is optional -->\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:133
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:125
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Of course, there can't be a reference to the purchae on the other side, for "
|
||||
"bidirectional association navigation. Remember that components are value "
|
||||
"types and don't allow shared references. A single <literal>Purchase</"
|
||||
"literal> can be in the set of an <literal>Order</literal>, but it can't be "
|
||||
"referenced by the <literal>Item</literal> at the same time."
|
||||
msgstr ""
|
||||
"Claro, que não pode ter uma referência para purchase no outro lado, para a "
|
||||
"navegação da associação bidirecional. Lembre-se que componentes são tipos "
|
||||
"por valor e não permitem referências compartilhadas. Uma classe "
|
||||
"<literal>Purchase</literal> simples pode estar no set de uma classe "
|
||||
"<literal>Order</literal>, mas ela não pode ser referenciada por "
|
||||
"<literal>Item</literal> no mesmo momento."
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:133
|
||||
#, no-c-format
|
||||
msgid "Even ternary (or quaternary, etc) associations are possible:"
|
||||
msgstr ""
|
||||
msgstr "Até mesmo associações ternárias (ou quaternária, etc) são possíveis:"
|
||||
|
||||
#: index.docbook:135
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:135
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"eg.Order\" .... >\n"
|
||||
" ....\n"
|
||||
" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"
|
||||
" <key column=\"order_id\">\n"
|
||||
" <composite-element class=\"eg.OrderLine\">\n"
|
||||
" <many-to-one name=\"purchaseDetails class=\"eg.Purchase\"/>\n"
|
||||
" <many-to-one name=\"item\" class=\"eg.Item\"/>\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
"<![CDATA[<class name=\"eg.Order\" .... >\n"
|
||||
" ....\n"
|
||||
" <set name=\"purchasedItems\" table=\"purchase_items\" lazy=\"true\">\n"
|
||||
" <key column=\"order_id\">\n"
|
||||
" <composite-element class=\"eg.OrderLine\">\n"
|
||||
" <many-to-one name=\"purchaseDetails class=\"eg.Purchase\"/>\n"
|
||||
" <many-to-one name=\"item\" class=\"eg.Item\"/>\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:137
|
||||
msgid "Composite elements may appear in queries using the same syntax as associations to other entities."
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:137
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Composite elements may appear in queries using the same syntax as "
|
||||
"associations to other entities."
|
||||
msgstr ""
|
||||
"Elementos compostos podem aparecer em pesquisas usando a mesma sintaxe assim "
|
||||
"como associações para outras entidades."
|
||||
|
||||
#: index.docbook:145
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:145
|
||||
#, no-c-format
|
||||
msgid "Components as Map indices"
|
||||
msgstr ""
|
||||
msgstr "Componentes como índices de Map"
|
||||
|
||||
#: index.docbook:147
|
||||
msgid "The <literal><composite-map-key></literal> element lets you map a component class as the key of a <literal>Map</literal>. Make sure you override <literal>hashCode()</literal> and <literal>equals()</literal> correctly on the component class."
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:147
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The <literal><composite-map-key></literal> element lets you map a "
|
||||
"component class as the key of a <literal>Map</literal>. Make sure you "
|
||||
"override <literal>hashCode()</literal> and <literal>equals()</literal> "
|
||||
"correctly on the component class."
|
||||
msgstr ""
|
||||
"O elemento <literal><composite-map-key></literal> permite você mapear "
|
||||
"uma classe componente como uma chave de um <literal>Map</literal>. Tenha "
|
||||
"certeza que você sobrescreveu <literal>hashCode()</literal> e <literal>equals"
|
||||
"()</literal> corretamente na classe componente."
|
||||
|
||||
#: index.docbook:156
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:156
|
||||
#, no-c-format
|
||||
msgid "Components as composite identifiers"
|
||||
msgstr ""
|
||||
msgstr ". Componentes como identificadores compostos"
|
||||
|
||||
#: index.docbook:158
|
||||
msgid "You may use a component as an identifier of an entity class. Your component class must satisfy certain requirements:"
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:158
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"You may use a component as an identifier of an entity class. Your component "
|
||||
"class must satisfy certain requirements:"
|
||||
msgstr ""
|
||||
"Você pode usar um componente como um identificador de uma classe entidade. "
|
||||
"Sua classe componente deve satisfazer certos requisitos:"
|
||||
|
||||
#: index.docbook:165
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:165
|
||||
#, no-c-format
|
||||
msgid "It must implement <literal>java.io.Serializable</literal>."
|
||||
msgstr ""
|
||||
msgstr "Ele deve implementar <literal>java.io.Serializable</literal>."
|
||||
|
||||
#: index.docbook:170
|
||||
msgid "It must re-implement <literal>equals()</literal> and <literal>hashCode()</literal>, consistently with the database's notion of composite key equality."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:179
|
||||
msgid "Note: in Hibernate3, the second requirement is not an absolutely hard requirement of Hibernate. But do it anyway."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:183
|
||||
msgid "You can't use an <literal>IdentifierGenerator</literal> to generate composite keys. Instead the application must assign its own identifiers."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:188
|
||||
msgid "Use the <literal><composite-id></literal> tag (with nested <literal><key-property></literal> elements) in place of the usual <literal><id></literal> declaration. For example, the <literal>OrderLine</literal> class has a primary key that depends upon the (composite) primary key of <literal>Order</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:196
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:170
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"OrderLine\">\n"
|
||||
" \n"
|
||||
" <composite-id name=\"id\" class=\"OrderLineId\">\n"
|
||||
" <key-property name=\"lineId\"/>\n"
|
||||
" <key-property name=\"orderId\"/>\n"
|
||||
" <key-property name=\"customerId\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" \n"
|
||||
" <property name=\"name\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"order\" class=\"Order\"\n"
|
||||
" insert=\"false\" update=\"false\">\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </many-to-one>\n"
|
||||
" ....\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
"It must re-implement <literal>equals()</literal> and <literal>hashCode()</"
|
||||
"literal>, consistently with the database's notion of composite key equality."
|
||||
msgstr ""
|
||||
"Ele deve re-implementar <literal>equals()</literal> e <literal>hashCode()</"
|
||||
"literal>, consistentemente com a noção de igualdade de chave composta do "
|
||||
"banco de dados."
|
||||
|
||||
#: index.docbook:198
|
||||
msgid "Now, any foreign keys referencing the <literal>OrderLine</literal> table are also composite. You must declare this in your mappings for other classes. An association to <literal>OrderLine</literal> would be mapped like this:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:204
|
||||
#. Tag: emphasis
|
||||
#: component_mapping.xml:179
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<many-to-one name=\"orderLine\" class=\"OrderLine\">\n"
|
||||
"<!-- the \"class\" attribute is optional, as usual -->\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
"</many-to-one>]]>"
|
||||
"Note: in Hibernate3, the second requirement is not an absolutely hard "
|
||||
"requirement of Hibernate. But do it anyway."
|
||||
msgstr ""
|
||||
"Nota: no Hibernate 3, o segundo requisito não é um requisito absolutamente "
|
||||
"necessário. Mas atenda ele de qualquer forma."
|
||||
|
||||
#: index.docbook:206
|
||||
msgid "(Note that the <literal><column></literal> tag is an alternative to the <literal>column</literal> attribute everywhere.)"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:211
|
||||
msgid "A <literal>many-to-many</literal> association to <literal>OrderLine</literal> also uses the composite foreign key:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:216
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:183
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"undeliveredOrderLines\">\n"
|
||||
" <key column name=\"warehouseId\"/>\n"
|
||||
" <many-to-many class=\"OrderLine\">\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </many-to-many>\n"
|
||||
"</set>]]>"
|
||||
"You can't use an <literal>IdentifierGenerator</literal> to generate "
|
||||
"composite keys. Instead the application must assign its own identifiers."
|
||||
msgstr ""
|
||||
"Você não pode usar um <literal>IdentifierGenerator</literal> para gerar "
|
||||
"chaves compostas. Ao invés disso o aplicativo deve gerenciar seus próprios "
|
||||
"identificadores."
|
||||
|
||||
#: index.docbook:218
|
||||
msgid "The collection of <literal>OrderLine</literal>s in <literal>Order</literal> would use:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:223
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:188
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"orderLines\" inverse=\"true\">\n"
|
||||
" <key>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </key>\n"
|
||||
" <one-to-many class=\"OrderLine\"/>\n"
|
||||
"</set>]]>"
|
||||
"Use the <literal><composite-id></literal> tag (with nested "
|
||||
"<literal><key-property></literal> elements) in place of the usual "
|
||||
"<literal><id></literal> declaration. For example, the "
|
||||
"<literal>OrderLine</literal> class has a primary key that depends upon the "
|
||||
"(composite) primary key of <literal>Order</literal>."
|
||||
msgstr ""
|
||||
"Use a tag <literal><composite-id></literal> (com elementos "
|
||||
"<literal><key-property></literal> aninhados) no lugar da declaração "
|
||||
"<literal><id></literal> de costume. Por exemplo, a classe "
|
||||
"<literal>OrderLine</literal> possui uma chave primária que depende da chave "
|
||||
"primária (composta) de <literal>Order</literal>."
|
||||
|
||||
#: index.docbook:225
|
||||
msgid "(The <literal><one-to-many></literal> element, as usual, declares no columns.)"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:229
|
||||
msgid "If <literal>OrderLine</literal> itself owns a collection, it also has a composite foreign key."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:234
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:196
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"OrderLine\">\n"
|
||||
" ....\n"
|
||||
" ....\n"
|
||||
" <list name=\"deliveryAttempts\">\n"
|
||||
" <key> <!-- a collection inherits the composite key type -->\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </key>\n"
|
||||
" <list-index column=\"attemptId\" base=\"1\"/>\n"
|
||||
" <composite-element class=\"DeliveryAttempt\">\n"
|
||||
" ...\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
"<![CDATA[<class name=\"OrderLine\">\n"
|
||||
" \n"
|
||||
" <composite-id name=\"id\" class=\"OrderLineId\">\n"
|
||||
" <key-property name=\"lineId\"/>\n"
|
||||
" <key-property name=\"orderId\"/>\n"
|
||||
" <key-property name=\"customerId\"/>\n"
|
||||
" </composite-id>\n"
|
||||
" \n"
|
||||
" <property name=\"name\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"order\" class=\"Order\"\n"
|
||||
" insert=\"false\" update=\"false\">\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </many-to-one>\n"
|
||||
" ....\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:239
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:198
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Now, any foreign keys referencing the <literal>OrderLine</literal> table are "
|
||||
"also composite. You must declare this in your mappings for other classes. An "
|
||||
"association to <literal>OrderLine</literal> would be mapped like this:"
|
||||
msgstr ""
|
||||
"Agora, qualquer chave estrangeira referenciando a tabela <literal>OrderLine</"
|
||||
"literal> também serão compostas. Você deve declarar isto em seus mapeamentos "
|
||||
"para outras classes. Uma associação para <literal>OrderLine</literal> seria "
|
||||
"mapeada dessa forma:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:204
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<many-to-one name=\"orderLine\" class=\"OrderLine\">\n"
|
||||
"<!-- the \"class\" attribute is optional, as usual -->\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
"</many-to-one>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:206
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"(Note that the <literal><column></literal> tag is an alternative to "
|
||||
"the <literal>column</literal> attribute everywhere.)"
|
||||
msgstr ""
|
||||
"(Note que a tag <literal><column></literal> é uma alternativa para o "
|
||||
"atributo <literal>column</literal> por toda a parte.)"
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:211
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A <literal>many-to-many</literal> association to <literal>OrderLine</"
|
||||
"literal> also uses the composite foreign key:"
|
||||
msgstr ""
|
||||
"Uma associação <literal>many-to-many</literal> para <literal>many-to-many</"
|
||||
"literal> também usa a chave estrangeira composta:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:216
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"undeliveredOrderLines\">\n"
|
||||
" <key column name=\"warehouseId\"/>\n"
|
||||
" <many-to-many class=\"OrderLine\">\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </many-to-many>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:218
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The collection of <literal>OrderLine</literal>s in <literal>Order</literal> "
|
||||
"would use:"
|
||||
msgstr ""
|
||||
"A collection de <literal>OrderLine</literal>s em <literal>Order</literal> "
|
||||
"usaria:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:223
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"orderLines\" inverse=\"true\">\n"
|
||||
" <key>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </key>\n"
|
||||
" <one-to-many class=\"OrderLine\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:225
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"(The <literal><one-to-many></literal> element, as usual, declares no "
|
||||
"columns.)"
|
||||
msgstr ""
|
||||
"(O elemento <literal><one-to-many></literal>, como de costume, não "
|
||||
"declara colunas.)"
|
||||
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:229
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"If <literal>OrderLine</literal> itself owns a collection, it also has a "
|
||||
"composite foreign key."
|
||||
msgstr ""
|
||||
"Se <literal>OrderLine</literal> possui uma collection, ela também tem uma "
|
||||
"chave estrangeira composta."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:234
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"OrderLine\">\n"
|
||||
" ....\n"
|
||||
" ....\n"
|
||||
" <list name=\"deliveryAttempts\">\n"
|
||||
" <key> <!-- a collection inherits the composite key type -->\n"
|
||||
" <column name=\"lineId\"/>\n"
|
||||
" <column name=\"orderId\"/>\n"
|
||||
" <column name=\"customerId\"/>\n"
|
||||
" </key>\n"
|
||||
" <list-index column=\"attemptId\" base=\"1\"/>\n"
|
||||
" <composite-element class=\"DeliveryAttempt\">\n"
|
||||
" ...\n"
|
||||
" </composite-element>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: component_mapping.xml:239
|
||||
#, no-c-format
|
||||
msgid "Dynamic components"
|
||||
msgstr ""
|
||||
msgstr "Componentes Dinâmicos"
|
||||
|
||||
#: index.docbook:241
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:241
|
||||
#, no-c-format
|
||||
msgid "You may even map a property of type <literal>Map</literal>:"
|
||||
msgstr ""
|
||||
"Você pode até mesmo mapear uma propriedade do tipo <literal>Map</literal>:"
|
||||
|
||||
#: index.docbook:245
|
||||
#. Tag: programlisting
|
||||
#: component_mapping.xml:245
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<dynamic-component name=\"userAttributes\">\n"
|
||||
" <property name=\"foo\" column=\"FOO\" type=\"string\"/>\n"
|
||||
" <property name=\"bar\" column=\"BAR\" type=\"integer\"/>\n"
|
||||
" <many-to-one name=\"baz\" class=\"Baz\" column=\"BAZ_ID\"/>\n"
|
||||
"</dynamic-component>]]>"
|
||||
"<![CDATA[<dynamic-component name=\"userAttributes\">\n"
|
||||
" <property name=\"foo\" column=\"FOO\" type=\"string\"/>\n"
|
||||
" <property name=\"bar\" column=\"BAR\" type=\"integer\"/>\n"
|
||||
" <many-to-one name=\"baz\" class=\"Baz\" column=\"BAZ_ID\"/>\n"
|
||||
"</dynamic-component>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:247
|
||||
msgid "The semantics of a <literal><dynamic-component></literal> mapping are identical to <literal><component></literal>. The advantage of this kind of mapping is the ability to determine the actual properties of the bean at deployment time, just by editing the mapping document. Runtime manipulation of the mapping document is also possible, using a DOM parser. Even better, you can access (and change) Hibernate's configuration-time metamodel via the <literal>Configuration</literal> object."
|
||||
#. Tag: para
|
||||
#: component_mapping.xml:247
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The semantics of a <literal><dynamic-component></literal> mapping are "
|
||||
"identical to <literal><component></literal>. The advantage of this "
|
||||
"kind of mapping is the ability to determine the actual properties of the "
|
||||
"bean at deployment time, just by editing the mapping document. Runtime "
|
||||
"manipulation of the mapping document is also possible, using a DOM parser. "
|
||||
"Even better, you can access (and change) Hibernate's configuration-time "
|
||||
"metamodel via the <literal>Configuration</literal> object."
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
"A semântica de um mapeamento <literal><dynamic-component></literal> é "
|
||||
"idêntica à <literal><component></literal>. A vantagem deste tipo de "
|
||||
"mapeamento é a habilidade de determinar as propriedades atuais do bean no "
|
||||
"momento de deploy, apenas editando o documento de mapeamento. A Manipulação "
|
||||
"em tempo de execução do documento de mapeamento também é possível, usando o "
|
||||
"parser DOM. Até melhor, você pode acessar (e mudar) o metamodelo "
|
||||
"configuration-time do Hibernate através do objeto <literal>Configuration</"
|
||||
"literal>."
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,245 +1,481 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: events.xml:5
|
||||
#, no-c-format
|
||||
msgid "Interceptors and events"
|
||||
msgstr ""
|
||||
msgstr "Interceptadores e Eventos"
|
||||
|
||||
#: index.docbook:7
|
||||
msgid "It is often useful for the application to react to certain events that occur inside Hibernate. This allows implementation of certain kinds of generic functionality, and extension of Hibernate functionality."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:14
|
||||
msgid "Interceptors"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:16
|
||||
msgid "The <literal>Interceptor</literal> interface provides callbacks from the session to the application allowing the application to inspect and/or manipulate properties of a persistent object before it is saved, updated, deleted or loaded. One possible use for this is to track auditing information. For example, the following <literal>Interceptor</literal> automatically sets the <literal>createTimestamp</literal> when an <literal>Auditable</literal> is created and updates the <literal>lastUpdateTimestamp</literal> property when an <literal>Auditable</literal> is updated."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:27
|
||||
msgid "You may either implement <literal>Interceptor</literal> directly or (better) extend <literal>EmptyInterceptor</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:32
|
||||
#. Tag: para
|
||||
#: events.xml:7
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package org.hibernate.test;\n"
|
||||
"\n"
|
||||
"import java.io.Serializable;\n"
|
||||
"import java.util.Date;\n"
|
||||
"import java.util.Iterator;\n"
|
||||
"\n"
|
||||
"import org.hibernate.EmptyInterceptor;\n"
|
||||
"import org.hibernate.Transaction;\n"
|
||||
"import org.hibernate.type.Type;\n"
|
||||
"\n"
|
||||
"public class AuditInterceptor extends EmptyInterceptor {\n"
|
||||
"\n"
|
||||
" private int updates;\n"
|
||||
" private int creates;\n"
|
||||
" private int loads;\n"
|
||||
"\n"
|
||||
" public void onDelete(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] state,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
" // do nothing\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public boolean onFlushDirty(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] currentState,\n"
|
||||
" Object[] previousState,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
"\n"
|
||||
" if ( entity instanceof Auditable ) {\n"
|
||||
" updates++;\n"
|
||||
" for ( int i=0; i < propertyNames.length; i++ ) {\n"
|
||||
" if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) {\n"
|
||||
" currentState[i] = new Date();\n"
|
||||
" return true;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" return false;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public boolean onLoad(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] state,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
" if ( entity instanceof Auditable ) {\n"
|
||||
" loads++;\n"
|
||||
" }\n"
|
||||
" return false;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public boolean onSave(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] state,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
"\n"
|
||||
" if ( entity instanceof Auditable ) {\n"
|
||||
" creates++;\n"
|
||||
" for ( int i=0; i<propertyNames.length; i++ ) {\n"
|
||||
" if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
|
||||
" state[i] = new Date();\n"
|
||||
" return true;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" return false;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public void afterTransactionCompletion(Transaction tx) {\n"
|
||||
" if ( tx.wasCommitted() ) {\n"
|
||||
" System.out.println(\"Creations: \" + creates + \", Updates: \" + updates, \"Loads: \" + loads);\n"
|
||||
" }\n"
|
||||
" updates=0;\n"
|
||||
" creates=0;\n"
|
||||
" loads=0;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"}]]>"
|
||||
"It is often useful for the application to react to certain events that occur "
|
||||
"inside Hibernate. This allows implementation of certain kinds of generic "
|
||||
"functionality, and extension of Hibernate functionality."
|
||||
msgstr ""
|
||||
"É muito útil quando a aplicação precisa executar alguma \"coisa\" no momento "
|
||||
"em que o Hibernate executa uma de suas ações. Isso permite a implementação "
|
||||
"de certas funções genéricas, assim como permite estender as funcionalidades "
|
||||
"do Hibernate"
|
||||
|
||||
#. Tag: title
|
||||
#: events.xml:14
|
||||
#, no-c-format
|
||||
msgid "Interceptors"
|
||||
msgstr "Interceptadores"
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:16
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The <literal>Interceptor</literal> interface provides callbacks from the "
|
||||
"session to the application allowing the application to inspect and/or "
|
||||
"manipulate properties of a persistent object before it is saved, updated, "
|
||||
"deleted or loaded. One possible use for this is to track auditing "
|
||||
"information. For example, the following <literal>Interceptor</literal> "
|
||||
"automatically sets the <literal>createTimestamp</literal> when an "
|
||||
"<literal>Auditable</literal> is created and updates the "
|
||||
"<literal>lastUpdateTimestamp</literal> property when an <literal>Auditable</"
|
||||
"literal> is updated."
|
||||
msgstr ""
|
||||
"A interface <literal>Interceptor</literal> permite fornecer informações da "
|
||||
"session para o aplicativo, permitindo ao aplicativo inspecionar e/ou "
|
||||
"manipular as propriedades de um objeto persistente antes de ser salvo, "
|
||||
"atualizado, excluído ou salvo. Um dos possíveis usos é gerar informações de "
|
||||
"auditoria. Por exemplo, o seguinte <literal>Interceptor</literal> seta "
|
||||
"automaticamente o atributo <literal>createTimestamp</literal> quando um "
|
||||
"<literal>Auditable</literal> é criada e atualiza o atributo "
|
||||
"<literal>lastUpdateTimestamp</literal> quando um <literal>Auditable</"
|
||||
"literal> é atualizado."
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:27
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"You may either implement <literal>Interceptor</literal> directly or (better) "
|
||||
"extend <literal>EmptyInterceptor</literal>."
|
||||
msgstr ""
|
||||
"Você pode implementar <literal>Auditable</literal> diretamente ou pode "
|
||||
"estender <literal>EmptyInterceptor</literal>, sendo que a segunda é "
|
||||
"considerada a melhor opção."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: events.xml:32
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package org.hibernate.test;\n"
|
||||
"\n"
|
||||
"import java.io.Serializable;\n"
|
||||
"import java.util.Date;\n"
|
||||
"import java.util.Iterator;\n"
|
||||
"\n"
|
||||
"import org.hibernate.EmptyInterceptor;\n"
|
||||
"import org.hibernate.Transaction;\n"
|
||||
"import org.hibernate.type.Type;\n"
|
||||
"\n"
|
||||
"public class AuditInterceptor extends EmptyInterceptor {\n"
|
||||
"\n"
|
||||
" private int updates;\n"
|
||||
" private int creates;\n"
|
||||
" private int loads;\n"
|
||||
"\n"
|
||||
" public void onDelete(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] state,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
" // do nothing\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public boolean onFlushDirty(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] currentState,\n"
|
||||
" Object[] previousState,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
"\n"
|
||||
" if ( entity instanceof Auditable ) {\n"
|
||||
" updates++;\n"
|
||||
" for ( int i=0; i < propertyNames.length; i++ ) {\n"
|
||||
" if ( \"lastUpdateTimestamp\".equals( propertyNames[i] ) ) {\n"
|
||||
" currentState[i] = new Date();\n"
|
||||
" return true;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" return false;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public boolean onLoad(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] state,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
" if ( entity instanceof Auditable ) {\n"
|
||||
" loads++;\n"
|
||||
" }\n"
|
||||
" return false;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public boolean onSave(Object entity,\n"
|
||||
" Serializable id,\n"
|
||||
" Object[] state,\n"
|
||||
" String[] propertyNames,\n"
|
||||
" Type[] types) {\n"
|
||||
"\n"
|
||||
" if ( entity instanceof Auditable ) {\n"
|
||||
" creates++;\n"
|
||||
" for ( int i=0; i<propertyNames.length; i++ ) {\n"
|
||||
" if ( \"createTimestamp\".equals( propertyNames[i] ) ) {\n"
|
||||
" state[i] = new Date();\n"
|
||||
" return true;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" return false;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" public void afterTransactionCompletion(Transaction tx) {\n"
|
||||
" if ( tx.wasCommitted() ) {\n"
|
||||
" System.out.println(\"Creations: \" + creates + \", Updates: \" + "
|
||||
"updates, \"Loads: \" + loads);\n"
|
||||
" }\n"
|
||||
" updates=0;\n"
|
||||
" creates=0;\n"
|
||||
" loads=0;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:34
|
||||
msgid "Interceptors come in two flavors: <literal>Session</literal>-scoped and <literal>SessionFactory</literal>-scoped."
|
||||
#. Tag: para
|
||||
#: events.xml:34
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Interceptors come in two flavors: <literal>Session</literal>-scoped and "
|
||||
"<literal>SessionFactory</literal>-scoped."
|
||||
msgstr ""
|
||||
"Os interceptadores podem ser aplicados em dois diferentes escopos: No escopo "
|
||||
"da <literal>Session</literal> e no escopo <literal>SessionFactory</literal>."
|
||||
|
||||
#: index.docbook:39
|
||||
msgid "A <literal>Session</literal>-scoped interceptor is specified when a session is opened using one of the overloaded SessionFactory.openSession() methods accepting an <literal>Interceptor</literal>."
|
||||
#. Tag: para
|
||||
#: events.xml:39
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A <literal>Session</literal>-scoped interceptor is specified when a session "
|
||||
"is opened using one of the overloaded SessionFactory.openSession() methods "
|
||||
"accepting an <literal>Interceptor</literal>."
|
||||
msgstr ""
|
||||
"Um interceptador no escopo da <literal>Session</literal> é definido quando "
|
||||
"uma sessão é aberta usando o método sobrecarregado da SessionFactory."
|
||||
"openSession() que aceita um <literal>Interceptor</literal> como parâmetro."
|
||||
|
||||
#: index.docbook:45
|
||||
#. Tag: programlisting
|
||||
#: events.xml:45
|
||||
#, no-c-format
|
||||
msgid "<![CDATA[Session session = sf.openSession( new AuditInterceptor() );]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:47
|
||||
msgid "A <literal>SessionFactory</literal>-scoped interceptor is registered with the <literal>Configuration</literal> object prior to building the <literal>SessionFactory</literal>. In this case, the supplied interceptor will be applied to all sessions opened from that <literal>SessionFactory</literal>; this is true unless a session is opened explicitly specifying the interceptor to use. <literal>SessionFactory</literal>-scoped interceptors must be thread safe, taking care to not store session-specific state since multiple sessions will use this interceptor (potentially) concurrently."
|
||||
#. Tag: para
|
||||
#: events.xml:47
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A <literal>SessionFactory</literal>-scoped interceptor is registered with "
|
||||
"the <literal>Configuration</literal> object prior to building the "
|
||||
"<literal>SessionFactory</literal>. In this case, the supplied interceptor "
|
||||
"will be applied to all sessions opened from that <literal>SessionFactory</"
|
||||
"literal>; this is true unless a session is opened explicitly specifying the "
|
||||
"interceptor to use. <literal>SessionFactory</literal>-scoped interceptors "
|
||||
"must be thread safe, taking care to not store session-specific state since "
|
||||
"multiple sessions will use this interceptor (potentially) concurrently."
|
||||
msgstr ""
|
||||
"Um interceptador no escopo da <literal>SessionFactory</literal> é definido "
|
||||
"no objeto <literal>Configuration</literal> antes da <literal>SessionFactory</"
|
||||
"literal> ser instanciada. Nesse caso, o interceptador fornecido será "
|
||||
"aplicado para todas as sessões abertas por aquela <literal>SessionFactory</"
|
||||
"literal>; Isso apenas não ocorrerá caso seja especificado um interceptador "
|
||||
"no momento em que a sessão for aberta. Um interceptador no escopo de "
|
||||
"<literal>SessionFactory</literal> deve ser thread safe, tomando-se o cuidado "
|
||||
"de não armazenar atributos de estado específicos da sessão, pois, "
|
||||
"provavelmente, múltiplas sessões irão utilizar esse interceptador "
|
||||
"simultaneamente."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: events.xml:56
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:56
|
||||
msgid "<![CDATA[new Configuration().setInterceptor( new AuditInterceptor() );]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:61
|
||||
#. Tag: title
|
||||
#: events.xml:61
|
||||
#, no-c-format
|
||||
msgid "Event system"
|
||||
msgstr ""
|
||||
msgstr "Sistema de Eventos"
|
||||
|
||||
#: index.docbook:63
|
||||
msgid "If you have to react to particular events in your persistence layer, you may also use the Hibernate3 <emphasis>event</emphasis> architecture. The event system can be used in addition or as a replacement for interceptors."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:69
|
||||
msgid "Essentially all of the methods of the <literal>Session</literal> interface correlate to an event. You have a <literal>LoadEvent</literal>, a <literal>FlushEvent</literal>, etc (consult the XML configuration-file DTD or the <literal>org.hibernate.event</literal> package for the full list of defined event types). When a request is made of one of these methods, the Hibernate <literal>Session</literal> generates an appropriate event and passes it to the configured event listeners for that type. Out-of-the-box, these listeners implement the same processing in which those methods always resulted. However, you are free to implement a customization of one of the listener interfaces (i.e., the <literal>LoadEvent</literal> is processed by the registered implemenation of the <literal>LoadEventListener</literal> interface), in which case their implementation would be responsible for processing any <literal>load()</literal> requests made of the <literal>Session</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:84
|
||||
msgid "The listeners should be considered effectively singletons; meaning, they are shared between requests, and thus should not save any state as instance variables."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:89
|
||||
msgid "A custom listener should implement the appropriate interface for the event it wants to process and/or extend one of the convenience base classes (or even the default event listeners used by Hibernate out-of-the-box as these are declared non-final for this purpose). Custom listeners can either be registered programmatically through the <literal>Configuration</literal> object, or specified in the Hibernate configuration XML (declarative configuration through the properties file is not supported). Here's an example of a custom load event listener:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:99
|
||||
#. Tag: para
|
||||
#: events.xml:63
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class MyLoadListener implements LoadEventListener {\n"
|
||||
" // this is the single method defined by the LoadEventListener interface\n"
|
||||
" public void onLoad(LoadEvent event, LoadEventListener.LoadType loadType)\n"
|
||||
" throws HibernateException {\n"
|
||||
" if ( !MySecurity.isAuthorized( event.getEntityClassName(), event.getEntityId() ) ) {\n"
|
||||
" throw MySecurityException(\"Unauthorized access\");\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
"If you have to react to particular events in your persistence layer, you may "
|
||||
"also use the Hibernate3 <emphasis>event</emphasis> architecture. The event "
|
||||
"system can be used in addition or as a replacement for interceptors."
|
||||
msgstr ""
|
||||
"Se você precisa executar uma ação em determinados eventos da camada de "
|
||||
"persistência, você também pode usar a arquitetura de <emphasis>event</"
|
||||
"emphasis> do Hibernate3. Um evento do sistema pode ser utilizado como "
|
||||
"complemento ou em substituição a um interceptador."
|
||||
|
||||
#: index.docbook:101
|
||||
msgid "You also need a configuration entry telling Hibernate to use the listener in addition to the default listener:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:106
|
||||
#. Tag: para
|
||||
#: events.xml:69
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<hibernate-configuration>\n"
|
||||
" <session-factory>\n"
|
||||
" ...\n"
|
||||
" <event type=\"load\">\n"
|
||||
" <listener class=\"com.eg.MyLoadListener\"/>\n"
|
||||
" <listener class=\"org.hibernate.event.def.DefaultLoadEventListener\"/>\n"
|
||||
" </event>\n"
|
||||
" </session-factory>\n"
|
||||
"</hibernate-configuration>]]>"
|
||||
"Essentially all of the methods of the <literal>Session</literal> interface "
|
||||
"correlate to an event. You have a <literal>LoadEvent</literal>, a "
|
||||
"<literal>FlushEvent</literal>, etc (consult the XML configuration-file DTD "
|
||||
"or the <literal>org.hibernate.event</literal> package for the full list of "
|
||||
"defined event types). When a request is made of one of these methods, the "
|
||||
"Hibernate <literal>Session</literal> generates an appropriate event and "
|
||||
"passes it to the configured event listeners for that type. Out-of-the-box, "
|
||||
"these listeners implement the same processing in which those methods always "
|
||||
"resulted. However, you are free to implement a customization of one of the "
|
||||
"listener interfaces (i.e., the <literal>LoadEvent</literal> is processed by "
|
||||
"the registered implemenation of the <literal>LoadEventListener</literal> "
|
||||
"interface), in which case their implementation would be responsible for "
|
||||
"processing any <literal>load()</literal> requests made of the "
|
||||
"<literal>Session</literal>."
|
||||
msgstr ""
|
||||
"Essencialmente todos os métodos da interface <literal>Session</literal> "
|
||||
"possuem um evento correlacionado. Se você tiver um <literal>LoadEvent</"
|
||||
"literal>, um <literal>LoadEvent</literal>, etc (consulte o DTD do XML de "
|
||||
"configuração ou o pacote <literal>org.hibernate.event</literal> para a lista "
|
||||
"completa dos tipos de eventos). Quando uma requisição é feita em um desses "
|
||||
"métodos, a <literal>Session</literal> do hibernate gera um evento apropriado "
|
||||
"e o envia para o listener de evento correspondente àquele tipo de evento. "
|
||||
"Esses listeners implementam a mesma lógica que aqueles métodos, trazendo os "
|
||||
"mesmos resultados. Entretanto, você é livre para implementar uma "
|
||||
"customização de um desses listeners (isto é, o <literal>LoadEvent</literal> "
|
||||
"é processado pela implementação registrada da interface "
|
||||
"<literal>LoadEventListener</literal>), então sua implementação vai ficar "
|
||||
"responsável por processar qualquer requisição <literal>load()</literal> "
|
||||
"feita pela <literal>Session</literal>."
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:84
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The listeners should be considered effectively singletons; meaning, they are "
|
||||
"shared between requests, and thus should not save any state as instance "
|
||||
"variables."
|
||||
msgstr ""
|
||||
"Para todos os efeitos esses listeners deve ser considerados singletons; ou "
|
||||
"seja, eles são compartilhados entre as requisições, e assim sendo, não devem "
|
||||
"salvar nenhum estado das variáveis instanciadas."
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:89
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A custom listener should implement the appropriate interface for the event "
|
||||
"it wants to process and/or extend one of the convenience base classes (or "
|
||||
"even the default event listeners used by Hibernate out-of-the-box as these "
|
||||
"are declared non-final for this purpose). Custom listeners can either be "
|
||||
"registered programmatically through the <literal>Configuration</literal> "
|
||||
"object, or specified in the Hibernate configuration XML (declarative "
|
||||
"configuration through the properties file is not supported). Here's an "
|
||||
"example of a custom load event listener:"
|
||||
msgstr ""
|
||||
"Um listener personalizado deve implementar a interface referente ao evento a "
|
||||
"ser processado e/ou deve estender a classes base equivalente (ou mesmo os "
|
||||
"listeners padrões usados pelo Hibernate, eles não são declarados como finais "
|
||||
"com esse objetivo). O listener personalizado pode ser registrado "
|
||||
"programaticamente no objeto <literal>Configuration</literal>, ou "
|
||||
"declarativamente no XML de configuração do Hibernate (o registro do listener "
|
||||
"no propertie de configuração não é suportado). Aqui temos um exemplo de como "
|
||||
"carregar um listener personalizado:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: events.xml:99
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public class MyLoadListener implements LoadEventListener {\n"
|
||||
" // this is the single method defined by the LoadEventListener interface\n"
|
||||
" public void onLoad(LoadEvent event, LoadEventListener.LoadType "
|
||||
"loadType)\n"
|
||||
" throws HibernateException {\n"
|
||||
" if ( !MySecurity.isAuthorized( event.getEntityClassName(), event."
|
||||
"getEntityId() ) ) {\n"
|
||||
" throw MySecurityException(\"Unauthorized access\");\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:108
|
||||
#. Tag: para
|
||||
#: events.xml:101
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"You also need a configuration entry telling Hibernate to use the listener in "
|
||||
"addition to the default listener:"
|
||||
msgstr ""
|
||||
"Você também precisa adicionar uma entrada no XML de configuração do "
|
||||
"Hibernate para registrar declarativamente qual listener deve se utilizado em "
|
||||
"conjunto com o listener padrão:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: events.xml:106
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<hibernate-configuration>\n"
|
||||
" <session-factory>\n"
|
||||
" ...\n"
|
||||
" <event type=\"load\">\n"
|
||||
" <listener class=\"com.eg.MyLoadListener\"/>\n"
|
||||
" <listener class=\"org.hibernate.event.def."
|
||||
"DefaultLoadEventListener\"/>\n"
|
||||
" </event>\n"
|
||||
" </session-factory>\n"
|
||||
"</hibernate-configuration>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:108
|
||||
#, no-c-format
|
||||
msgid "Instead, you may register it programmatically:"
|
||||
msgstr ""
|
||||
msgstr "Ou, você pode registrar o listener programaticamente:"
|
||||
|
||||
#: index.docbook:112
|
||||
#. Tag: programlisting
|
||||
#: events.xml:112
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Configuration cfg = new Configuration();\n"
|
||||
"LoadEventListener[] stack = { new MyLoadListener(), new DefaultLoadEventListener() };\n"
|
||||
"cfg.EventListeners().setLoadEventListeners(stack);]]>"
|
||||
"<![CDATA[Configuration cfg = new Configuration();\n"
|
||||
"LoadEventListener[] stack = { new MyLoadListener(), new "
|
||||
"DefaultLoadEventListener() };\n"
|
||||
"cfg.EventListeners().setLoadEventListeners(stack);]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:114
|
||||
msgid "Listeners registered declaratively cannot share instances. If the same class name is used in multiple <literal><listener/></literal> elements, each reference will result in a separate instance of that class. If you need the capability to share listener instances between listener types you must use the programmatic registration approach."
|
||||
#. Tag: para
|
||||
#: events.xml:114
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Listeners registered declaratively cannot share instances. If the same class "
|
||||
"name is used in multiple <literal><listener/></literal> elements, each "
|
||||
"reference will result in a separate instance of that class. If you need the "
|
||||
"capability to share listener instances between listener types you must use "
|
||||
"the programmatic registration approach."
|
||||
msgstr ""
|
||||
"Listeners registrados declarativamente não compartilham da mesma instancia. "
|
||||
"Se o mesmo nome da classe é utilizado em vários elementos e <literal><"
|
||||
"listener/></literal>, cada um vai resultar em uma instancia separada "
|
||||
"dessa classe. Se você tem a necessidade de compartilhar uma instancia de um "
|
||||
"listener entre diversos tipos de listeners você deve registrar o listener "
|
||||
"programaticamente."
|
||||
|
||||
#: index.docbook:122
|
||||
msgid "Why implement an interface and define the specific type during configuration? Well, a listener implementation could implement multiple event listener interfaces. Having the type additionally defined during registration makes it easier to turn custom listeners on or off during configuration."
|
||||
#. Tag: para
|
||||
#: events.xml:122
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Why implement an interface and define the specific type during "
|
||||
"configuration? Well, a listener implementation could implement multiple "
|
||||
"event listener interfaces. Having the type additionally defined during "
|
||||
"registration makes it easier to turn custom listeners on or off during "
|
||||
"configuration."
|
||||
msgstr ""
|
||||
"Mas porque implementar uma interface e definir o tipo específico durante a "
|
||||
"configuração? Bem, um listener pode implementar vários listeners de evento. "
|
||||
"Com o tipo sendo definido durante o registro, fica fácil ligar ou desligar "
|
||||
"listeners personalizados durante a configuração."
|
||||
|
||||
#: index.docbook:132
|
||||
#. Tag: title
|
||||
#: events.xml:132
|
||||
#, no-c-format
|
||||
msgid "Hibernate declarative security"
|
||||
msgstr ""
|
||||
msgstr "Hibernate declarative security"
|
||||
|
||||
#: index.docbook:133
|
||||
msgid "Usually, declarative security in Hibernate applications is managed in a session facade layer. Now, Hibernate3 allows certain actions to be permissioned via JACC, and authorized via JAAS. This is optional functionality built on top of the event architecture."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:139
|
||||
msgid "First, you must configure the appropriate event listeners, to enable the use of JAAS authorization."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:144
|
||||
#. Tag: para
|
||||
#: events.xml:133
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<listener type=\"pre-delete\" class=\"org.hibernate.secure.JACCPreDeleteEventListener\"/>\n"
|
||||
"<listener type=\"pre-update\" class=\"org.hibernate.secure.JACCPreUpdateEventListener\"/>\n"
|
||||
"<listener type=\"pre-insert\" class=\"org.hibernate.secure.JACCPreInsertEventListener\"/>\n"
|
||||
"<listener type=\"pre-load\" class=\"org.hibernate.secure.JACCPreLoadEventListener\"/>]]>"
|
||||
"Usually, declarative security in Hibernate applications is managed in a "
|
||||
"session facade layer. Now, Hibernate3 allows certain actions to be "
|
||||
"permissioned via JACC, and authorized via JAAS. This is optional "
|
||||
"functionality built on top of the event architecture."
|
||||
msgstr ""
|
||||
"Usually, declarative security in Hibernate applications is managed in a "
|
||||
"session facade layer. Now, Hibernate3 allows certain actions to be "
|
||||
"permissioned via JACC, and authorized via JAAS. This is optional "
|
||||
"functionality built on top of the event architecture."
|
||||
|
||||
#: index.docbook:146
|
||||
msgid "Note that <literal><listener type=\"...\" class=\"...\"/></literal> is just a shorthand for <literal><event type=\"...\"><listener class=\"...\"/></event></literal> when there is exactly one listener for a particular event type."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:152
|
||||
msgid "Next, still in <literal>hibernate.cfg.xml</literal>, bind the permissions to roles:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:156
|
||||
#. Tag: para
|
||||
#: events.xml:139
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,read\"/>\n"
|
||||
"<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>]]>"
|
||||
"First, you must configure the appropriate event listeners, to enable the use "
|
||||
"of JAAS authorization."
|
||||
msgstr ""
|
||||
"First, you must configure the appropriate event listeners, to enable the use "
|
||||
"of JAAS authorization."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: events.xml:144
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<listener type=\"pre-delete\" class=\"org.hibernate.secure."
|
||||
"JACCPreDeleteEventListener\"/>\n"
|
||||
"<listener type=\"pre-update\" class=\"org.hibernate.secure."
|
||||
"JACCPreUpdateEventListener\"/>\n"
|
||||
"<listener type=\"pre-insert\" class=\"org.hibernate.secure."
|
||||
"JACCPreInsertEventListener\"/>\n"
|
||||
"<listener type=\"pre-load\" class=\"org.hibernate.secure."
|
||||
"JACCPreLoadEventListener\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:158
|
||||
#. Tag: para
|
||||
#: events.xml:146
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note that <literal><listener type=\"...\" class=\"...\"/></literal> is "
|
||||
"just a shorthand for <literal><event type=\"...\"><listener class="
|
||||
"\"...\"/></event></literal> when there is exactly one listener for "
|
||||
"a particular event type."
|
||||
msgstr ""
|
||||
"Note that <literal><listener type=\"...\" class=\"...\"/></literal> is "
|
||||
"just a shorthand for <literal><event type=\"...\"><listener class="
|
||||
"\"...\"/></event></literal> when there is exactly one listener for "
|
||||
"a particular event type."
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:152
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Next, still in <literal>hibernate.cfg.xml</literal>, bind the permissions to "
|
||||
"roles:"
|
||||
msgstr ""
|
||||
"Next, still in <literal>hibernate.cfg.xml</literal>, bind the permissions to "
|
||||
"roles:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: events.xml:156
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<grant role=\"admin\" entity-name=\"User\" actions=\"insert,update,"
|
||||
"read\"/>\n"
|
||||
"<grant role=\"su\" entity-name=\"User\" actions=\"*\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: events.xml:158
|
||||
#, no-c-format
|
||||
msgid "The role names are the roles understood by your JACC provider."
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
msgstr "The role names are the roles understood by your JACC provider."
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,287 +1,605 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: example_parentchild.xml:5
|
||||
#, no-c-format
|
||||
msgid "Example: Parent/Child"
|
||||
msgstr ""
|
||||
msgstr "Example: Parent/Child"
|
||||
|
||||
#: index.docbook:7
|
||||
msgid "One of the very first things that new users try to do with Hibernate is to model a parent / child type relationship. There are two different approaches to this. For various reasons the most convenient approach, especially for new users, is to model both <literal>Parent</literal> and <literal>Child</literal> as entity classes with a <literal><one-to-many></literal> association from <literal>Parent</literal> to <literal>Child</literal>. (The alternative approach is to declare the <literal>Child</literal> as a <literal><composite-element></literal>.) Now, it turns out that default semantics of a one to many association (in Hibernate) are much less close to the usual semantics of a parent / child relationship than those of a composite element mapping. We will explain how to use a <emphasis>bidirectional one to many association with cascades</emphasis> to model a parent / child relationship efficiently and elegantly. It's not at all difficult!"
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:7
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"One of the very first things that new users try to do with Hibernate is to "
|
||||
"model a parent / child type relationship. There are two different approaches "
|
||||
"to this. For various reasons the most convenient approach, especially for "
|
||||
"new users, is to model both <literal>Parent</literal> and <literal>Child</"
|
||||
"literal> as entity classes with a <literal><one-to-many></literal> "
|
||||
"association from <literal>Parent</literal> to <literal>Child</literal>. (The "
|
||||
"alternative approach is to declare the <literal>Child</literal> as a "
|
||||
"<literal><composite-element></literal>.) Now, it turns out that "
|
||||
"default semantics of a one to many association (in Hibernate) are much less "
|
||||
"close to the usual semantics of a parent / child relationship than those of "
|
||||
"a composite element mapping. We will explain how to use a "
|
||||
"<emphasis>bidirectional one to many association with cascades</emphasis> to "
|
||||
"model a parent / child relationship efficiently and elegantly. It's not at "
|
||||
"all difficult!"
|
||||
msgstr ""
|
||||
"One of the very first things that new users try to do with Hibernate is to "
|
||||
"model a parent / child type relationship. There are two different approaches "
|
||||
"to this. For various reasons the most convenient approach, especially for "
|
||||
"new users, is to model both <literal>Parent</literal> and <literal>Child</"
|
||||
"literal> as entity classes with a <literal><one-to-many></literal> "
|
||||
"association from <literal>Parent</literal> to <literal>Child</literal>. (The "
|
||||
"alternative approach is to declare the <literal>Child</literal> as a "
|
||||
"<literal><composite-element></literal>.) Now, it turns out that "
|
||||
"default semantics of a one to many association (in Hibernate) are much less "
|
||||
"close to the usual semantics of a parent / child relationship than those of "
|
||||
"a composite element mapping. We will explain how to use a "
|
||||
"<emphasis>bidirectional one to many association with cascades</emphasis> to "
|
||||
"model a parent / child relationship efficiently and elegantly. It's not at "
|
||||
"all difficult!"
|
||||
|
||||
#: index.docbook:21
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:21
|
||||
#, no-c-format
|
||||
msgid "A note about collections"
|
||||
msgstr ""
|
||||
msgstr "A note about collections"
|
||||
|
||||
#: index.docbook:23
|
||||
msgid "Hibernate collections are considered to be a logical part of their owning entity; never of the contained entities. This is a crucial distinction! It has the following consequences:"
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:23
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate collections are considered to be a logical part of their owning "
|
||||
"entity; never of the contained entities. This is a crucial distinction! It "
|
||||
"has the following consequences:"
|
||||
msgstr ""
|
||||
"Hibernate collections are considered to be a logical part of their owning "
|
||||
"entity; never of the contained entities. This is a crucial distinction! It "
|
||||
"has the following consequences:"
|
||||
|
||||
#: index.docbook:30
|
||||
msgid "When we remove / add an object from / to a collection, the version number of the collection owner is incremented."
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:30
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"When we remove / add an object from / to a collection, the version number of "
|
||||
"the collection owner is incremented."
|
||||
msgstr ""
|
||||
"When we remove / add an object from / to a collection, the version number of "
|
||||
"the collection owner is incremented."
|
||||
|
||||
#: index.docbook:36
|
||||
msgid "If an object that was removed from a collection is an instance of a value type (eg, a composite element), that object will cease to be persistent and its state will be completely removed from the database. Likewise, adding a value type instance to the collection will cause its state to be immediately persistent."
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:36
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"If an object that was removed from a collection is an instance of a value "
|
||||
"type (eg, a composite element), that object will cease to be persistent and "
|
||||
"its state will be completely removed from the database. Likewise, adding a "
|
||||
"value type instance to the collection will cause its state to be immediately "
|
||||
"persistent."
|
||||
msgstr ""
|
||||
"If an object that was removed from a collection is an instance of a value "
|
||||
"type (eg, a composite element), that object will cease to be persistent and "
|
||||
"its state will be completely removed from the database. Likewise, adding a "
|
||||
"value type instance to the collection will cause its state to be immediately "
|
||||
"persistent."
|
||||
|
||||
#: index.docbook:44
|
||||
msgid "On the other hand, if an entity is removed from a collection (a one-to-many or many-to-many association), it will not be deleted, by default. This behaviour is completely consistent - a change to the internal state of another entity should not cause the associated entity to vanish! Likewise, adding an entity to a collection does not cause that entity to become persistent, by default."
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:44
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"On the other hand, if an entity is removed from a collection (a one-to-many "
|
||||
"or many-to-many association), it will not be deleted, by default. This "
|
||||
"behaviour is completely consistent - a change to the internal state of "
|
||||
"another entity should not cause the associated entity to vanish! Likewise, "
|
||||
"adding an entity to a collection does not cause that entity to become "
|
||||
"persistent, by default."
|
||||
msgstr ""
|
||||
"On the other hand, if an entity is removed from a collection (a one-to-many "
|
||||
"or many-to-many association), it will not be deleted, by default. This "
|
||||
"behaviour is completely consistent - a change to the internal state of "
|
||||
"another entity should not cause the associated entity to vanish! Likewise, "
|
||||
"adding an entity to a collection does not cause that entity to become "
|
||||
"persistent, by default."
|
||||
|
||||
#: index.docbook:54
|
||||
msgid "Instead, the default behaviour is that adding an entity to a collection merely creates a link between the two entities, while removing it removes the link. This is very appropriate for all sorts of cases. Where it is not appropriate at all is the case of a parent / child relationship, where the life of the child is bound to the life cycle of the parent."
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:54
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Instead, the default behaviour is that adding an entity to a collection "
|
||||
"merely creates a link between the two entities, while removing it removes "
|
||||
"the link. This is very appropriate for all sorts of cases. Where it is not "
|
||||
"appropriate at all is the case of a parent / child relationship, where the "
|
||||
"life of the child is bound to the life cycle of the parent."
|
||||
msgstr ""
|
||||
"Instead, the default behaviour is that adding an entity to a collection "
|
||||
"merely creates a link between the two entities, while removing it removes "
|
||||
"the link. This is very appropriate for all sorts of cases. Where it is not "
|
||||
"appropriate at all is the case of a parent / child relationship, where the "
|
||||
"life of the child is bound to the life cycle of the parent."
|
||||
|
||||
#: index.docbook:64
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:64
|
||||
#, no-c-format
|
||||
msgid "Bidirectional one-to-many"
|
||||
msgstr ""
|
||||
msgstr "Bidirectional one-to-many"
|
||||
|
||||
#: index.docbook:66
|
||||
msgid "Suppose we start with a simple <literal><one-to-many></literal> association from <literal>Parent</literal> to <literal>Child</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:71
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:66
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
"Suppose we start with a simple <literal><one-to-many></literal> "
|
||||
"association from <literal>Parent</literal> to <literal>Child</literal>."
|
||||
msgstr ""
|
||||
"Suppose we start with a simple <literal><one-to-many></literal> "
|
||||
"association from <literal>Parent</literal> to <literal>Child</literal>."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:71
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:73
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:73
|
||||
#, no-c-format
|
||||
msgid "If we were to execute the following code"
|
||||
msgstr ""
|
||||
msgstr "If we were to execute the following code"
|
||||
|
||||
#: index.docbook:77
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:77
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = .....;\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.getChildren().add(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
"<![CDATA[Parent p = .....;\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.getChildren().add(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:79
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:79
|
||||
#, no-c-format
|
||||
msgid "Hibernate would issue two SQL statements:"
|
||||
msgstr ""
|
||||
msgstr "Hibernate would issue two SQL statements:"
|
||||
|
||||
#: index.docbook:85
|
||||
msgid "an <literal>INSERT</literal> to create the record for <literal>c</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:88
|
||||
msgid "an <literal>UPDATE</literal> to create the link from <literal>p</literal> to <literal>c</literal>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:95
|
||||
msgid "This is not only inefficient, but also violates any <literal>NOT NULL</literal> constraint on the <literal>parent_id</literal> column. We can fix the nullability constraint violation by specifying <literal>not-null=\"true\"</literal> in the collection mapping:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:101
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:85
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\">\n"
|
||||
" <key column=\"parent_id\" not-null=\"true\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
"an <literal>INSERT</literal> to create the record for <literal>c</literal>"
|
||||
msgstr ""
|
||||
"an <literal>INSERT</literal> to create the record for <literal>c</literal>"
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:88
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"an <literal>UPDATE</literal> to create the link from <literal>p</literal> to "
|
||||
"<literal>c</literal>"
|
||||
msgstr ""
|
||||
"an <literal>UPDATE</literal> to create the link from <literal>p</literal> to "
|
||||
"<literal>c</literal>"
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:95
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This is not only inefficient, but also violates any <literal>NOT NULL</"
|
||||
"literal> constraint on the <literal>parent_id</literal> column. We can fix "
|
||||
"the nullability constraint violation by specifying <literal>not-null=\"true"
|
||||
"\"</literal> in the collection mapping:"
|
||||
msgstr ""
|
||||
"This is not only inefficient, but also violates any <literal>NOT NULL</"
|
||||
"literal> constraint on the <literal>parent_id</literal> column. We can fix "
|
||||
"the nullability constraint violation by specifying <literal>not-null=\"true"
|
||||
"\"</literal> in the collection mapping:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:101
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\">\n"
|
||||
" <key column=\"parent_id\" not-null=\"true\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:103
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:103
|
||||
#, no-c-format
|
||||
msgid "However, this is not the recommended solution."
|
||||
msgstr ""
|
||||
msgstr "However, this is not the recommended solution."
|
||||
|
||||
#: index.docbook:106
|
||||
msgid "The underlying cause of this behaviour is that the link (the foreign key <literal>parent_id</literal>) from <literal>p</literal> to <literal>c</literal> is not considered part of the state of the <literal>Child</literal> object and is therefore not created in the <literal>INSERT</literal>. So the solution is to make the link part of the <literal>Child</literal> mapping."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:113
|
||||
msgid "<![CDATA[<many-to-one name=\"parent\" column=\"parent_id\" not-null=\"true\"/>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:115
|
||||
msgid "(We also need to add the <literal>parent</literal> property to the <literal>Child</literal> class.)"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:119
|
||||
msgid "Now that the <literal>Child</literal> entity is managing the state of the link, we tell the collection not to update the link. We use the <literal>inverse</literal> attribute."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:124
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:106
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
"The underlying cause of this behaviour is that the link (the foreign key "
|
||||
"<literal>parent_id</literal>) from <literal>p</literal> to <literal>c</"
|
||||
"literal> is not considered part of the state of the <literal>Child</literal> "
|
||||
"object and is therefore not created in the <literal>INSERT</literal>. So the "
|
||||
"solution is to make the link part of the <literal>Child</literal> mapping."
|
||||
msgstr ""
|
||||
"The underlying cause of this behaviour is that the link (the foreign key "
|
||||
"<literal>parent_id</literal>) from <literal>p</literal> to <literal>c</"
|
||||
"literal> is not considered part of the state of the <literal>Child</literal> "
|
||||
"object and is therefore not created in the <literal>INSERT</literal>. So the "
|
||||
"solution is to make the link part of the <literal>Child</literal> mapping."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:113
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<many-to-one name=\"parent\" column=\"parent_id\" not-null=\"true\"/"
|
||||
">]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:126
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:115
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"(We also need to add the <literal>parent</literal> property to the "
|
||||
"<literal>Child</literal> class.)"
|
||||
msgstr ""
|
||||
"(We also need to add the <literal>parent</literal> property to the "
|
||||
"<literal>Child</literal> class.)"
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:119
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Now that the <literal>Child</literal> entity is managing the state of the "
|
||||
"link, we tell the collection not to update the link. We use the "
|
||||
"<literal>inverse</literal> attribute."
|
||||
msgstr ""
|
||||
"Now that the <literal>Child</literal> entity is managing the state of the "
|
||||
"link, we tell the collection not to update the link. We use the "
|
||||
"<literal>inverse</literal> attribute."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:124
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:126
|
||||
#, no-c-format
|
||||
msgid "The following code would be used to add a new <literal>Child</literal>"
|
||||
msgstr ""
|
||||
msgstr "The following code would be used to add a new <literal>Child</literal>"
|
||||
|
||||
#: index.docbook:130
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:130
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"c.setParent(p);\n"
|
||||
"p.getChildren().add(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"c.setParent(p);\n"
|
||||
"p.getChildren().add(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:132
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:132
|
||||
#, no-c-format
|
||||
msgid "And now, only one SQL <literal>INSERT</literal> would be issued!"
|
||||
msgstr ""
|
||||
msgstr "And now, only one SQL <literal>INSERT</literal> would be issued!"
|
||||
|
||||
#: index.docbook:136
|
||||
msgid "To tighten things up a bit, we could create an <literal>addChild()</literal> method of <literal>Parent</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:141
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:136
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public void addChild(Child c) {\n"
|
||||
" c.setParent(this);\n"
|
||||
" children.add(c);\n"
|
||||
"}]]>"
|
||||
"To tighten things up a bit, we could create an <literal>addChild()</literal> "
|
||||
"method of <literal>Parent</literal>."
|
||||
msgstr ""
|
||||
"To tighten things up a bit, we could create an <literal>addChild()</literal> "
|
||||
"method of <literal>Parent</literal>."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:141
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[public void addChild(Child c) {\n"
|
||||
" c.setParent(this);\n"
|
||||
" children.add(c);\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:143
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:143
|
||||
#, no-c-format
|
||||
msgid "Now, the code to add a <literal>Child</literal> looks like"
|
||||
msgstr ""
|
||||
msgstr "Now, the code to add a <literal>Child</literal> looks like"
|
||||
|
||||
#: index.docbook:147
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:147
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.addChild(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.addChild(c);\n"
|
||||
"session.save(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:152
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:152
|
||||
#, no-c-format
|
||||
msgid "Cascading life cycle"
|
||||
msgstr ""
|
||||
msgstr "Cascading life cycle"
|
||||
|
||||
#: index.docbook:154
|
||||
msgid "The explicit call to <literal>save()</literal> is still annoying. We will address this by using cascades."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:159
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:154
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\" cascade=\"all\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
"The explicit call to <literal>save()</literal> is still annoying. We will "
|
||||
"address this by using cascades."
|
||||
msgstr ""
|
||||
"The explicit call to <literal>save()</literal> is still annoying. We will "
|
||||
"address this by using cascades."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:159
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\" cascade=\"all\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:161
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:161
|
||||
#, no-c-format
|
||||
msgid "This simplifies the code above to"
|
||||
msgstr ""
|
||||
msgstr "This simplifies the code above to"
|
||||
|
||||
#: index.docbook:165
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:165
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.addChild(c);\n"
|
||||
"session.flush();]]>"
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = new Child();\n"
|
||||
"p.addChild(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:167
|
||||
msgid "Similarly, we don't need to iterate over the children when saving or deleting a <literal>Parent</literal>. The following removes <literal>p</literal> and all its children from the database."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:172
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:167
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"session.delete(p);\n"
|
||||
"session.flush();]]>"
|
||||
"Similarly, we don't need to iterate over the children when saving or "
|
||||
"deleting a <literal>Parent</literal>. The following removes <literal>p</"
|
||||
"literal> and all its children from the database."
|
||||
msgstr ""
|
||||
"Similarly, we don't need to iterate over the children when saving or "
|
||||
"deleting a <literal>Parent</literal>. The following removes <literal>p</"
|
||||
"literal> and all its children from the database."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:172
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"session.delete(p);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:174
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:174
|
||||
#, no-c-format
|
||||
msgid "However, this code"
|
||||
msgstr ""
|
||||
msgstr "However, this code"
|
||||
|
||||
#: index.docbook:178
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:178
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = (Child) p.getChildren().iterator().next();\n"
|
||||
"p.getChildren().remove(c);\n"
|
||||
"c.setParent(null);\n"
|
||||
"session.flush();]]>"
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = (Child) p.getChildren().iterator().next();\n"
|
||||
"p.getChildren().remove(c);\n"
|
||||
"c.setParent(null);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:180
|
||||
msgid "will not remove <literal>c</literal> from the database; it will ony remove the link to <literal>p</literal> (and cause a <literal>NOT NULL</literal> constraint violation, in this case). You need to explicitly <literal>delete()</literal> the <literal>Child</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:186
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:180
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = (Child) p.getChildren().iterator().next();\n"
|
||||
"p.getChildren().remove(c);\n"
|
||||
"session.delete(c);\n"
|
||||
"session.flush();]]>"
|
||||
"will not remove <literal>c</literal> from the database; it will ony remove "
|
||||
"the link to <literal>p</literal> (and cause a <literal>NOT NULL</literal> "
|
||||
"constraint violation, in this case). You need to explicitly <literal>delete()"
|
||||
"</literal> the <literal>Child</literal>."
|
||||
msgstr ""
|
||||
"will not remove <literal>c</literal> from the database; it will ony remove "
|
||||
"the link to <literal>p</literal> (and cause a <literal>NOT NULL</literal> "
|
||||
"constraint violation, in this case). You need to explicitly <literal>delete()"
|
||||
"</literal> the <literal>Child</literal>."
|
||||
|
||||
#: index.docbook:188
|
||||
msgid "Now, in our case, a <literal>Child</literal> can't really exist without its parent. So if we remove a <literal>Child</literal> from the collection, we really do want it to be deleted. For this, we must use <literal>cascade=\"all-delete-orphan\"</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:194
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:186
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\" cascade=\"all-delete-orphan\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
"<![CDATA[Parent p = (Parent) session.load(Parent.class, pid);\n"
|
||||
"Child c = (Child) p.getChildren().iterator().next();\n"
|
||||
"p.getChildren().remove(c);\n"
|
||||
"session.delete(c);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:196
|
||||
msgid "Note: even though the collection mapping specifies <literal>inverse=\"true\"</literal>, cascades are still processed by iterating the collection elements. So if you require that an object be saved, deleted or updated by cascade, you must add it to the collection. It is not enough to simply call <literal>setParent()</literal>."
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:188
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Now, in our case, a <literal>Child</literal> can't really exist without its "
|
||||
"parent. So if we remove a <literal>Child</literal> from the collection, we "
|
||||
"really do want it to be deleted. For this, we must use <literal>cascade="
|
||||
"\"all-delete-orphan\"</literal>."
|
||||
msgstr ""
|
||||
"Now, in our case, a <literal>Child</literal> can't really exist without its "
|
||||
"parent. So if we remove a <literal>Child</literal> from the collection, we "
|
||||
"really do want it to be deleted. For this, we must use <literal>cascade="
|
||||
"\"all-delete-orphan\"</literal>."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:194
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set name=\"children\" inverse=\"true\" cascade=\"all-delete-orphan"
|
||||
"\">\n"
|
||||
" <key column=\"parent_id\"/>\n"
|
||||
" <one-to-many class=\"Child\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:206
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:196
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note: even though the collection mapping specifies <literal>inverse=\"true"
|
||||
"\"</literal>, cascades are still processed by iterating the collection "
|
||||
"elements. So if you require that an object be saved, deleted or updated by "
|
||||
"cascade, you must add it to the collection. It is not enough to simply call "
|
||||
"<literal>setParent()</literal>."
|
||||
msgstr ""
|
||||
"Note: even though the collection mapping specifies <literal>inverse=\"true"
|
||||
"\"</literal>, cascades are still processed by iterating the collection "
|
||||
"elements. So if you require that an object be saved, deleted or updated by "
|
||||
"cascade, you must add it to the collection. It is not enough to simply call "
|
||||
"<literal>setParent()</literal>."
|
||||
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:206
|
||||
#, no-c-format
|
||||
msgid "Cascades and <literal>unsaved-value</literal>"
|
||||
msgstr ""
|
||||
msgstr "Cascades and <literal>unsaved-value</literal>"
|
||||
|
||||
#: index.docbook:208
|
||||
msgid "Suppose we loaded up a <literal>Parent</literal> in one <literal>Session</literal>, made some changes in a UI action and wish to persist these changes in a new session by calling <literal>update()</literal>. The <literal>Parent</literal> will contain a collection of childen and, since cascading update is enabled, Hibernate needs to know which children are newly instantiated and which represent existing rows in the database. Lets assume that both <literal>Parent</literal> and <literal>Child</literal> have genenerated identifier properties of type <literal>Long</literal>. Hibernate will use the identifier and version/timestamp property value to determine which of the children are new. (See <xref linkend=\"objectstate-saveorupdate\"/>.) <emphasis>In Hibernate3, it is no longer necessary to specify an <literal>unsaved-value</literal> explicitly.</emphasis>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:220
|
||||
msgid "The following code will update <literal>parent</literal> and <literal>child</literal> and insert <literal>newChild</literal>."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:225
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:208
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[//parent and child were both loaded in a previous session\n"
|
||||
"parent.addChild(child);\n"
|
||||
"Child newChild = new Child();\n"
|
||||
"parent.addChild(newChild);\n"
|
||||
"session.update(parent);\n"
|
||||
"session.flush();]]>"
|
||||
"Suppose we loaded up a <literal>Parent</literal> in one <literal>Session</"
|
||||
"literal>, made some changes in a UI action and wish to persist these changes "
|
||||
"in a new session by calling <literal>update()</literal>. The "
|
||||
"<literal>Parent</literal> will contain a collection of childen and, since "
|
||||
"cascading update is enabled, Hibernate needs to know which children are "
|
||||
"newly instantiated and which represent existing rows in the database. Lets "
|
||||
"assume that both <literal>Parent</literal> and <literal>Child</literal> have "
|
||||
"genenerated identifier properties of type <literal>Long</literal>. Hibernate "
|
||||
"will use the identifier and version/timestamp property value to determine "
|
||||
"which of the children are new. (See <xref linkend=\"objectstate-saveorupdate"
|
||||
"\"/>.) <emphasis>In Hibernate3, it is no longer necessary to specify an "
|
||||
"<literal>unsaved-value</literal> explicitly.</emphasis>"
|
||||
msgstr ""
|
||||
"Suppose we loaded up a <literal>Parent</literal> in one <literal>Session</"
|
||||
"literal>, made some changes in a UI action and wish to persist these changes "
|
||||
"in a new session by calling <literal>update()</literal>. The "
|
||||
"<literal>Parent</literal> will contain a collection of childen and, since "
|
||||
"cascading update is enabled, Hibernate needs to know which children are "
|
||||
"newly instantiated and which represent existing rows in the database. Lets "
|
||||
"assume that both <literal>Parent</literal> and <literal>Child</literal> have "
|
||||
"genenerated identifier properties of type <literal>Long</literal>. Hibernate "
|
||||
"will use the identifier and version/timestamp property value to determine "
|
||||
"which of the children are new. (See <xref linkend=\"objectstate-saveorupdate"
|
||||
"\"/>.) <emphasis>In Hibernate3, it is no longer necessary to specify an "
|
||||
"<literal>unsaved-value</literal> explicitly.</emphasis>"
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:220
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The following code will update <literal>parent</literal> and <literal>child</"
|
||||
"literal> and insert <literal>newChild</literal>."
|
||||
msgstr ""
|
||||
"The following code will update <literal>parent</literal> and <literal>child</"
|
||||
"literal> and insert <literal>newChild</literal>."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_parentchild.xml:225
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[//parent and child were both loaded in a previous session\n"
|
||||
"parent.addChild(child);\n"
|
||||
"Child newChild = new Child();\n"
|
||||
"parent.addChild(newChild);\n"
|
||||
"session.update(parent);\n"
|
||||
"session.flush();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:227
|
||||
msgid "Well, that's all very well for the case of a generated identifier, but what about assigned identifiers and composite identifiers? This is more difficult, since Hibernate can't use the identifier property to distinguish between a newly instantiated object (with an identifier assigned by the user) and an object loaded in a previous session. In this case, Hibernate will either use the timestamp or version property, or will actually query the second-level cache or, worst case, the database, to see if the row exists."
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:227
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Well, that's all very well for the case of a generated identifier, but what "
|
||||
"about assigned identifiers and composite identifiers? This is more "
|
||||
"difficult, since Hibernate can't use the identifier property to distinguish "
|
||||
"between a newly instantiated object (with an identifier assigned by the "
|
||||
"user) and an object loaded in a previous session. In this case, Hibernate "
|
||||
"will either use the timestamp or version property, or will actually query "
|
||||
"the second-level cache or, worst case, the database, to see if the row "
|
||||
"exists."
|
||||
msgstr ""
|
||||
"Well, that's all very well for the case of a generated identifier, but what "
|
||||
"about assigned identifiers and composite identifiers? This is more "
|
||||
"difficult, since Hibernate can't use the identifier property to distinguish "
|
||||
"between a newly instantiated object (with an identifier assigned by the "
|
||||
"user) and an object loaded in a previous session. In this case, Hibernate "
|
||||
"will either use the timestamp or version property, or will actually query "
|
||||
"the second-level cache or, worst case, the database, to see if the row "
|
||||
"exists."
|
||||
|
||||
#: index.docbook:260
|
||||
#. Tag: title
|
||||
#: example_parentchild.xml:260
|
||||
#, no-c-format
|
||||
msgid "Conclusion"
|
||||
msgstr "Conclusion"
|
||||
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:262
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"There is quite a bit to digest here and it might look confusing first time "
|
||||
"around. However, in practice, it all works out very nicely. Most Hibernate "
|
||||
"applications use the parent / child pattern in many places."
|
||||
msgstr ""
|
||||
"There is quite a bit to digest here and it might look confusing first time "
|
||||
"around. However, in practice, it all works out very nicely. Most Hibernate "
|
||||
"applications use the parent / child pattern in many places."
|
||||
|
||||
#: index.docbook:262
|
||||
msgid "There is quite a bit to digest here and it might look confusing first time around. However, in practice, it all works out very nicely. Most Hibernate applications use the parent / child pattern in many places."
|
||||
#. Tag: para
|
||||
#: example_parentchild.xml:267
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"We mentioned an alternative in the first paragraph. None of the above issues "
|
||||
"exist in the case of <literal><composite-element></literal> mappings, "
|
||||
"which have exactly the semantics of a parent / child relationship. "
|
||||
"Unfortunately, there are two big limitations to composite element classes: "
|
||||
"composite elements may not own collections, and they should not be the child "
|
||||
"of any entity other than the unique parent."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:267
|
||||
msgid "We mentioned an alternative in the first paragraph. None of the above issues exist in the case of <literal><composite-element></literal> mappings, which have exactly the semantics of a parent / child relationship. Unfortunately, there are two big limitations to composite element classes: composite elements may not own collections, and they should not be the child of any entity other than the unique parent."
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
"We mentioned an alternative in the first paragraph. None of the above issues "
|
||||
"exist in the case of <literal><composite-element></literal> mappings, "
|
||||
"which have exactly the semantics of a parent / child relationship. "
|
||||
"Unfortunately, there are two big limitations to composite element classes: "
|
||||
"composite elements may not own collections, and they should not be the child "
|
||||
"of any entity other than the unique parent."
|
||||
|
|
|
@ -1,450 +1,484 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: example_weblog.xml:5
|
||||
#, no-c-format
|
||||
msgid "Example: Weblog Application"
|
||||
msgstr ""
|
||||
msgstr "Example: Weblog Application"
|
||||
|
||||
#: index.docbook:8
|
||||
#. Tag: title
|
||||
#: example_weblog.xml:8
|
||||
#, no-c-format
|
||||
msgid "Persistent Classes"
|
||||
msgstr ""
|
||||
msgstr "Persistent Classes"
|
||||
|
||||
#: index.docbook:10
|
||||
msgid "The persistent classes represent a weblog, and an item posted in a weblog. They are to be modelled as a standard parent/child relationship, but we will use an ordered bag, instead of a set."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:16
|
||||
#. Tag: para
|
||||
#: example_weblog.xml:10
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.util.List;\n"
|
||||
"\n"
|
||||
"public class Blog {\n"
|
||||
" private Long _id;\n"
|
||||
" private String _name;\n"
|
||||
" private List _items;\n"
|
||||
"\n"
|
||||
" public Long getId() {\n"
|
||||
" return _id;\n"
|
||||
" }\n"
|
||||
" public List getItems() {\n"
|
||||
" return _items;\n"
|
||||
" }\n"
|
||||
" public String getName() {\n"
|
||||
" return _name;\n"
|
||||
" }\n"
|
||||
" public void setId(Long long1) {\n"
|
||||
" _id = long1;\n"
|
||||
" }\n"
|
||||
" public void setItems(List list) {\n"
|
||||
" _items = list;\n"
|
||||
" }\n"
|
||||
" public void setName(String string) {\n"
|
||||
" _name = string;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
"The persistent classes represent a weblog, and an item posted in a weblog. "
|
||||
"They are to be modelled as a standard parent/child relationship, but we will "
|
||||
"use an ordered bag, instead of a set."
|
||||
msgstr ""
|
||||
"The persistent classes represent a weblog, and an item posted in a weblog. "
|
||||
"They are to be modelled as a standard parent/child relationship, but we will "
|
||||
"use an ordered bag, instead of a set."
|
||||
|
||||
#: index.docbook:18
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:16
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.text.DateFormat;\n"
|
||||
"import java.util.Calendar;\n"
|
||||
"\n"
|
||||
"public class BlogItem {\n"
|
||||
" private Long _id;\n"
|
||||
" private Calendar _datetime;\n"
|
||||
" private String _text;\n"
|
||||
" private String _title;\n"
|
||||
" private Blog _blog;\n"
|
||||
"\n"
|
||||
" public Blog getBlog() {\n"
|
||||
" return _blog;\n"
|
||||
" }\n"
|
||||
" public Calendar getDatetime() {\n"
|
||||
" return _datetime;\n"
|
||||
" }\n"
|
||||
" public Long getId() {\n"
|
||||
" return _id;\n"
|
||||
" }\n"
|
||||
" public String getText() {\n"
|
||||
" return _text;\n"
|
||||
" }\n"
|
||||
" public String getTitle() {\n"
|
||||
" return _title;\n"
|
||||
" }\n"
|
||||
" public void setBlog(Blog blog) {\n"
|
||||
" _blog = blog;\n"
|
||||
" }\n"
|
||||
" public void setDatetime(Calendar calendar) {\n"
|
||||
" _datetime = calendar;\n"
|
||||
" }\n"
|
||||
" public void setId(Long long1) {\n"
|
||||
" _id = long1;\n"
|
||||
" }\n"
|
||||
" public void setText(String string) {\n"
|
||||
" _text = string;\n"
|
||||
" }\n"
|
||||
" public void setTitle(String string) {\n"
|
||||
" _title = string;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.util.List;\n"
|
||||
"\n"
|
||||
"public class Blog {\n"
|
||||
" private Long _id;\n"
|
||||
" private String _name;\n"
|
||||
" private List _items;\n"
|
||||
"\n"
|
||||
" public Long getId() {\n"
|
||||
" return _id;\n"
|
||||
" }\n"
|
||||
" public List getItems() {\n"
|
||||
" return _items;\n"
|
||||
" }\n"
|
||||
" public String getName() {\n"
|
||||
" return _name;\n"
|
||||
" }\n"
|
||||
" public void setId(Long long1) {\n"
|
||||
" _id = long1;\n"
|
||||
" }\n"
|
||||
" public void setItems(List list) {\n"
|
||||
" _items = list;\n"
|
||||
" }\n"
|
||||
" public void setName(String string) {\n"
|
||||
" _name = string;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:23
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:18
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.text.DateFormat;\n"
|
||||
"import java.util.Calendar;\n"
|
||||
"\n"
|
||||
"public class BlogItem {\n"
|
||||
" private Long _id;\n"
|
||||
" private Calendar _datetime;\n"
|
||||
" private String _text;\n"
|
||||
" private String _title;\n"
|
||||
" private Blog _blog;\n"
|
||||
"\n"
|
||||
" public Blog getBlog() {\n"
|
||||
" return _blog;\n"
|
||||
" }\n"
|
||||
" public Calendar getDatetime() {\n"
|
||||
" return _datetime;\n"
|
||||
" }\n"
|
||||
" public Long getId() {\n"
|
||||
" return _id;\n"
|
||||
" }\n"
|
||||
" public String getText() {\n"
|
||||
" return _text;\n"
|
||||
" }\n"
|
||||
" public String getTitle() {\n"
|
||||
" return _title;\n"
|
||||
" }\n"
|
||||
" public void setBlog(Blog blog) {\n"
|
||||
" _blog = blog;\n"
|
||||
" }\n"
|
||||
" public void setDatetime(Calendar calendar) {\n"
|
||||
" _datetime = calendar;\n"
|
||||
" }\n"
|
||||
" public void setId(Long long1) {\n"
|
||||
" _id = long1;\n"
|
||||
" }\n"
|
||||
" public void setText(String string) {\n"
|
||||
" _text = string;\n"
|
||||
" }\n"
|
||||
" public void setTitle(String string) {\n"
|
||||
" _title = string;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: title
|
||||
#: example_weblog.xml:23
|
||||
#, no-c-format
|
||||
msgid "Hibernate Mappings"
|
||||
msgstr ""
|
||||
msgstr "Hibernate Mappings"
|
||||
|
||||
#: index.docbook:25
|
||||
#. Tag: para
|
||||
#: example_weblog.xml:25
|
||||
#, no-c-format
|
||||
msgid "The XML mappings should now be quite straightforward."
|
||||
msgstr ""
|
||||
msgstr "The XML mappings should now be quite straightforward."
|
||||
|
||||
#: index.docbook:29
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:29
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE hibernate-mapping PUBLIC\n"
|
||||
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
|
||||
" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n"
|
||||
"\n"
|
||||
"<hibernate-mapping package=\"eg\">\n"
|
||||
"\n"
|
||||
" <class\n"
|
||||
" name=\"Blog\"\n"
|
||||
" table=\"BLOGS\">\n"
|
||||
"\n"
|
||||
" <id\n"
|
||||
" name=\"id\"\n"
|
||||
" column=\"BLOG_ID\">\n"
|
||||
"\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
"\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"name\"\n"
|
||||
" column=\"NAME\"\n"
|
||||
" not-null=\"true\"\n"
|
||||
" unique=\"true\"/>\n"
|
||||
"\n"
|
||||
" <bag\n"
|
||||
" name=\"items\"\n"
|
||||
" inverse=\"true\"\n"
|
||||
" order-by=\"DATE_TIME\"\n"
|
||||
" cascade=\"all\">\n"
|
||||
"\n"
|
||||
" <key column=\"BLOG_ID\"/>\n"
|
||||
" <one-to-many class=\"BlogItem\"/>\n"
|
||||
"\n"
|
||||
" </bag>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
"<![CDATA[<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE hibernate-mapping PUBLIC\n"
|
||||
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
|
||||
" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n"
|
||||
"\n"
|
||||
"<hibernate-mapping package=\"eg\">\n"
|
||||
"\n"
|
||||
" <class\n"
|
||||
" name=\"Blog\"\n"
|
||||
" table=\"BLOGS\">\n"
|
||||
"\n"
|
||||
" <id\n"
|
||||
" name=\"id\"\n"
|
||||
" column=\"BLOG_ID\">\n"
|
||||
"\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
"\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"name\"\n"
|
||||
" column=\"NAME\"\n"
|
||||
" not-null=\"true\"\n"
|
||||
" unique=\"true\"/>\n"
|
||||
"\n"
|
||||
" <bag\n"
|
||||
" name=\"items\"\n"
|
||||
" inverse=\"true\"\n"
|
||||
" order-by=\"DATE_TIME\"\n"
|
||||
" cascade=\"all\">\n"
|
||||
"\n"
|
||||
" <key column=\"BLOG_ID\"/>\n"
|
||||
" <one-to-many class=\"BlogItem\"/>\n"
|
||||
"\n"
|
||||
" </bag>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:31
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:31
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE hibernate-mapping PUBLIC\n"
|
||||
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
|
||||
" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n"
|
||||
"\n"
|
||||
"<hibernate-mapping package=\"eg\">\n"
|
||||
"\n"
|
||||
" <class\n"
|
||||
" name=\"BlogItem\"\n"
|
||||
" table=\"BLOG_ITEMS\"\n"
|
||||
" dynamic-update=\"true\">\n"
|
||||
"\n"
|
||||
" <id\n"
|
||||
" name=\"id\"\n"
|
||||
" column=\"BLOG_ITEM_ID\">\n"
|
||||
"\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
"\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"title\"\n"
|
||||
" column=\"TITLE\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"text\"\n"
|
||||
" column=\"TEXT\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"datetime\"\n"
|
||||
" column=\"DATE_TIME\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <many-to-one\n"
|
||||
" name=\"blog\"\n"
|
||||
" column=\"BLOG_ID\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
"<![CDATA[<?xml version=\"1.0\"?>\n"
|
||||
"<!DOCTYPE hibernate-mapping PUBLIC\n"
|
||||
" \"-//Hibernate/Hibernate Mapping DTD 3.0//EN\"\n"
|
||||
" \"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd\">\n"
|
||||
"\n"
|
||||
"<hibernate-mapping package=\"eg\">\n"
|
||||
"\n"
|
||||
" <class\n"
|
||||
" name=\"BlogItem\"\n"
|
||||
" table=\"BLOG_ITEMS\"\n"
|
||||
" dynamic-update=\"true\">\n"
|
||||
"\n"
|
||||
" <id\n"
|
||||
" name=\"id\"\n"
|
||||
" column=\"BLOG_ITEM_ID\">\n"
|
||||
"\n"
|
||||
" <generator class=\"native\"/>\n"
|
||||
"\n"
|
||||
" </id>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"title\"\n"
|
||||
" column=\"TITLE\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"text\"\n"
|
||||
" column=\"TEXT\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <property\n"
|
||||
" name=\"datetime\"\n"
|
||||
" column=\"DATE_TIME\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" <many-to-one\n"
|
||||
" name=\"blog\"\n"
|
||||
" column=\"BLOG_ID\"\n"
|
||||
" not-null=\"true\"/>\n"
|
||||
"\n"
|
||||
" </class>\n"
|
||||
"\n"
|
||||
"</hibernate-mapping>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:36
|
||||
#. Tag: title
|
||||
#: example_weblog.xml:36
|
||||
#, no-c-format
|
||||
msgid "Hibernate Code"
|
||||
msgstr ""
|
||||
msgstr "Hibernate Code"
|
||||
|
||||
#: index.docbook:38
|
||||
msgid "The following class demonstrates some of the kinds of things we can do with these classes, using Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:43
|
||||
#. Tag: para
|
||||
#: example_weblog.xml:38
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.util.ArrayList;\n"
|
||||
"import java.util.Calendar;\n"
|
||||
"import java.util.Iterator;\n"
|
||||
"import java.util.List;\n"
|
||||
"\n"
|
||||
"import org.hibernate.HibernateException;\n"
|
||||
"import org.hibernate.Query;\n"
|
||||
"import org.hibernate.Session;\n"
|
||||
"import org.hibernate.SessionFactory;\n"
|
||||
"import org.hibernate.Transaction;\n"
|
||||
"import org.hibernate.cfg.Configuration;\n"
|
||||
"import org.hibernate.tool.hbm2ddl.SchemaExport;\n"
|
||||
"\n"
|
||||
"public class BlogMain {\n"
|
||||
" \n"
|
||||
" private SessionFactory _sessions;\n"
|
||||
" \n"
|
||||
" public void configure() throws HibernateException {\n"
|
||||
" _sessions = new Configuration()\n"
|
||||
" .addClass(Blog.class)\n"
|
||||
" .addClass(BlogItem.class)\n"
|
||||
" .buildSessionFactory();\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void exportTables() throws HibernateException {\n"
|
||||
" Configuration cfg = new Configuration()\n"
|
||||
" .addClass(Blog.class)\n"
|
||||
" .addClass(BlogItem.class);\n"
|
||||
" new SchemaExport(cfg).create(true, true);\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public Blog createBlog(String name) throws HibernateException {\n"
|
||||
" \n"
|
||||
" Blog blog = new Blog();\n"
|
||||
" blog.setName(name);\n"
|
||||
" blog.setItems( new ArrayList() );\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.persist(blog);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return blog;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public BlogItem createBlogItem(Blog blog, String title, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" BlogItem item = new BlogItem();\n"
|
||||
" item.setTitle(title);\n"
|
||||
" item.setText(text);\n"
|
||||
" item.setBlog(blog);\n"
|
||||
" item.setDatetime( Calendar.getInstance() );\n"
|
||||
" blog.getItems().add(item);\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.update(blog);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return item;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public BlogItem createBlogItem(Long blogid, String title, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" BlogItem item = new BlogItem();\n"
|
||||
" item.setTitle(title);\n"
|
||||
" item.setText(text);\n"
|
||||
" item.setDatetime( Calendar.getInstance() );\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Blog blog = (Blog) session.load(Blog.class, blogid);\n"
|
||||
" item.setBlog(blog);\n"
|
||||
" blog.getItems().add(item);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return item;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void updateBlogItem(BlogItem item, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" item.setText(text);\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.update(item);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void updateBlogItem(Long itemid, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" BlogItem item = (BlogItem) session.load(BlogItem.class, itemid);\n"
|
||||
" item.setText(text);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public List listAllBlogNamesAndItemCounts(int max)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" List result = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"select blog.id, blog.name, count(blogItem) \" +\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"left outer join blog.items as blogItem \" +\n"
|
||||
" \"group by blog.name, blog.id \" +\n"
|
||||
" \"order by max(blogItem.datetime)\"\n"
|
||||
" );\n"
|
||||
" q.setMaxResults(max);\n"
|
||||
" result = q.list();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return result;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public Blog getBlogAndAllItems(Long blogid)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" Blog blog = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"left outer join fetch blog.items \" +\n"
|
||||
" \"where blog.id = :blogid\"\n"
|
||||
" );\n"
|
||||
" q.setParameter(\"blogid\", blogid);\n"
|
||||
" blog = (Blog) q.uniqueResult();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return blog;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public List listBlogsAndRecentItems() throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" List result = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"inner join blog.items as blogItem \" +\n"
|
||||
" \"where blogItem.datetime > :minDate\"\n"
|
||||
" );\n"
|
||||
"\n"
|
||||
" Calendar cal = Calendar.getInstance();\n"
|
||||
" cal.roll(Calendar.MONTH, false);\n"
|
||||
" q.setCalendar(\"minDate\", cal);\n"
|
||||
" \n"
|
||||
" result = q.list();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return result;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
"The following class demonstrates some of the kinds of things we can do with "
|
||||
"these classes, using Hibernate."
|
||||
msgstr ""
|
||||
"The following class demonstrates some of the kinds of things we can do with "
|
||||
"these classes, using Hibernate."
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: example_weblog.xml:43
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[package eg;\n"
|
||||
"\n"
|
||||
"import java.util.ArrayList;\n"
|
||||
"import java.util.Calendar;\n"
|
||||
"import java.util.Iterator;\n"
|
||||
"import java.util.List;\n"
|
||||
"\n"
|
||||
"import org.hibernate.HibernateException;\n"
|
||||
"import org.hibernate.Query;\n"
|
||||
"import org.hibernate.Session;\n"
|
||||
"import org.hibernate.SessionFactory;\n"
|
||||
"import org.hibernate.Transaction;\n"
|
||||
"import org.hibernate.cfg.Configuration;\n"
|
||||
"import org.hibernate.tool.hbm2ddl.SchemaExport;\n"
|
||||
"\n"
|
||||
"public class BlogMain {\n"
|
||||
" \n"
|
||||
" private SessionFactory _sessions;\n"
|
||||
" \n"
|
||||
" public void configure() throws HibernateException {\n"
|
||||
" _sessions = new Configuration()\n"
|
||||
" .addClass(Blog.class)\n"
|
||||
" .addClass(BlogItem.class)\n"
|
||||
" .buildSessionFactory();\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void exportTables() throws HibernateException {\n"
|
||||
" Configuration cfg = new Configuration()\n"
|
||||
" .addClass(Blog.class)\n"
|
||||
" .addClass(BlogItem.class);\n"
|
||||
" new SchemaExport(cfg).create(true, true);\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public Blog createBlog(String name) throws HibernateException {\n"
|
||||
" \n"
|
||||
" Blog blog = new Blog();\n"
|
||||
" blog.setName(name);\n"
|
||||
" blog.setItems( new ArrayList() );\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.persist(blog);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return blog;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public BlogItem createBlogItem(Blog blog, String title, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" BlogItem item = new BlogItem();\n"
|
||||
" item.setTitle(title);\n"
|
||||
" item.setText(text);\n"
|
||||
" item.setBlog(blog);\n"
|
||||
" item.setDatetime( Calendar.getInstance() );\n"
|
||||
" blog.getItems().add(item);\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.update(blog);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return item;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public BlogItem createBlogItem(Long blogid, String title, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" BlogItem item = new BlogItem();\n"
|
||||
" item.setTitle(title);\n"
|
||||
" item.setText(text);\n"
|
||||
" item.setDatetime( Calendar.getInstance() );\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Blog blog = (Blog) session.load(Blog.class, blogid);\n"
|
||||
" item.setBlog(blog);\n"
|
||||
" blog.getItems().add(item);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return item;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void updateBlogItem(BlogItem item, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" item.setText(text);\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" session.update(item);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public void updateBlogItem(Long itemid, String text)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" BlogItem item = (BlogItem) session.load(BlogItem.class, "
|
||||
"itemid);\n"
|
||||
" item.setText(text);\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public List listAllBlogNamesAndItemCounts(int max)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" List result = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"select blog.id, blog.name, count(blogItem) \" +\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"left outer join blog.items as blogItem \" +\n"
|
||||
" \"group by blog.name, blog.id \" +\n"
|
||||
" \"order by max(blogItem.datetime)\"\n"
|
||||
" );\n"
|
||||
" q.setMaxResults(max);\n"
|
||||
" result = q.list();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return result;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public Blog getBlogAndAllItems(Long blogid)\n"
|
||||
" throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" Blog blog = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"left outer join fetch blog.items \" +\n"
|
||||
" \"where blog.id = :blogid\"\n"
|
||||
" );\n"
|
||||
" q.setParameter(\"blogid\", blogid);\n"
|
||||
" blog = (Blog) q.uniqueResult();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return blog;\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" public List listBlogsAndRecentItems() throws HibernateException {\n"
|
||||
" \n"
|
||||
" Session session = _sessions.openSession();\n"
|
||||
" Transaction tx = null;\n"
|
||||
" List result = null;\n"
|
||||
" try {\n"
|
||||
" tx = session.beginTransaction();\n"
|
||||
" Query q = session.createQuery(\n"
|
||||
" \"from Blog as blog \" +\n"
|
||||
" \"inner join blog.items as blogItem \" +\n"
|
||||
" \"where blogItem.datetime > :minDate\"\n"
|
||||
" );\n"
|
||||
"\n"
|
||||
" Calendar cal = Calendar.getInstance();\n"
|
||||
" cal.roll(Calendar.MONTH, false);\n"
|
||||
" q.setCalendar(\"minDate\", cal);\n"
|
||||
" \n"
|
||||
" result = q.list();\n"
|
||||
" tx.commit();\n"
|
||||
" }\n"
|
||||
" catch (HibernateException he) {\n"
|
||||
" if (tx!=null) tx.rollback();\n"
|
||||
" throw he;\n"
|
||||
" }\n"
|
||||
" finally {\n"
|
||||
" session.close();\n"
|
||||
" }\n"
|
||||
" return result;\n"
|
||||
" }\n"
|
||||
"}]]>"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,149 +1,290 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: filters.xml:5
|
||||
#, no-c-format
|
||||
msgid "Filtering data"
|
||||
msgstr ""
|
||||
msgstr "Filtrando dados"
|
||||
|
||||
#: index.docbook:7
|
||||
msgid "Hibernate3 provides an innovative new approach to handling data with \"visibility\" rules. A <emphasis>Hibernate filter</emphasis> is a global, named, parameterized filter that may be enabled or disabled for a particular Hibernate session."
|
||||
#. Tag: para
|
||||
#: filters.xml:7
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate3 provides an innovative new approach to handling data with "
|
||||
"\"visibility\" rules. A <emphasis>Hibernate filter</emphasis> is a global, "
|
||||
"named, parameterized filter that may be enabled or disabled for a particular "
|
||||
"Hibernate session."
|
||||
msgstr ""
|
||||
"O Hibernate3 provê um novo método inovador para manusear dados com regras de "
|
||||
"\"visibilidade\". Um <emphasis>Filtro do Hibernate</emphasis> é um filtro "
|
||||
"global, nomeado e parametrizado que pode se habilitado ou não dentro de um "
|
||||
"Session do Hibernate."
|
||||
|
||||
#: index.docbook:14
|
||||
#. Tag: title
|
||||
#: filters.xml:14
|
||||
#, no-c-format
|
||||
msgid "Hibernate filters"
|
||||
msgstr ""
|
||||
msgstr "Filtros do Hibernate"
|
||||
|
||||
#: index.docbook:16
|
||||
msgid "Hibernate3 adds the ability to pre-define filter criteria and attach those filters at both a class and a collection level. A filter criteria is the ability to define a restriction clause very similiar to the existing \"where\" attribute available on the class and various collection elements. Except these filter conditions can be parameterized. The application can then make the decision at runtime whether given filters should be enabled and what their parameter values should be. Filters can be used like database views, but parameterized inside the application."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:26
|
||||
msgid "In order to use filters, they must first be defined and then attached to the appropriate mapping elements. To define a filter, use the <literal><filter-def/></literal> element within a <literal><hibernate-mapping/></literal> element:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:32
|
||||
#. Tag: para
|
||||
#: filters.xml:16
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<filter-def name=\"myFilter\">\n"
|
||||
" <filter-param name=\"myFilterParam\" type=\"string\"/>\n"
|
||||
"</filter-def>]]>"
|
||||
"Hibernate3 adds the ability to pre-define filter criteria and attach those "
|
||||
"filters at both a class and a collection level. A filter criteria is the "
|
||||
"ability to define a restriction clause very similiar to the existing \"where"
|
||||
"\" attribute available on the class and various collection elements. Except "
|
||||
"these filter conditions can be parameterized. The application can then make "
|
||||
"the decision at runtime whether given filters should be enabled and what "
|
||||
"their parameter values should be. Filters can be used like database views, "
|
||||
"but parameterized inside the application."
|
||||
msgstr ""
|
||||
"O Hibernate tem a habilidade de pré definir os critérios do filtro e anexar "
|
||||
"esses filtros no nível da classe e no nível da coleção. Um critério do "
|
||||
"filtro é a habilidade de definir uma cláusula restritiva muito semelhante ao "
|
||||
"atributo \"where\" disponível para a classe e várias coleções. A não ser que "
|
||||
"essas condições de filtros podem ser parametrizadas. A aplicação pode, "
|
||||
"então, fazer uma decisão em tempo de execução se os filtros definidos devem "
|
||||
"estar habilitados e quais valores seus parâmetros devem ter. Os filtros "
|
||||
"podem ser usados como Views de bancos de dados, mas com parametros internos "
|
||||
"à aplicação."
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:26
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"In order to use filters, they must first be defined and then attached to the "
|
||||
"appropriate mapping elements. To define a filter, use the <literal><"
|
||||
"filter-def/></literal> element within a <literal><hibernate-mapping/"
|
||||
"></literal> element:"
|
||||
msgstr ""
|
||||
"Para usar esses filtros, eles primeiramente devem ser definidos e anexados "
|
||||
"aos elementos do mapeamento apropriados. Para definir um filtro, use o "
|
||||
"elemento <literal><filter-def/></literal> dentro do elemento "
|
||||
"<literal><hibernate-mapping/></literal>:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:32
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<filter-def name=\"myFilter\">\n"
|
||||
" <filter-param name=\"myFilterParam\" type=\"string\"/>\n"
|
||||
"</filter-def>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:34
|
||||
#. Tag: para
|
||||
#: filters.xml:34
|
||||
#, no-c-format
|
||||
msgid "Then, this filter can be attached to a class:"
|
||||
msgstr ""
|
||||
msgstr "Então esse filtro pode ser anexo à uma classe:"
|
||||
|
||||
#: index.docbook:38
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:38
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"myClass\" ...>\n"
|
||||
" ...\n"
|
||||
" <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN\"/>\n"
|
||||
"</class>]]>"
|
||||
"<![CDATA[<class name=\"myClass\" ...>\n"
|
||||
" ...\n"
|
||||
" <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN"
|
||||
"\"/>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:40
|
||||
#. Tag: para
|
||||
#: filters.xml:40
|
||||
#, no-c-format
|
||||
msgid "or, to a collection:"
|
||||
msgstr ""
|
||||
msgstr "ou em uma coleção:"
|
||||
|
||||
#: index.docbook:44
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:44
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<set ...>\n"
|
||||
" <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN\"/>\n"
|
||||
"</set>]]>"
|
||||
"<![CDATA[<set ...>\n"
|
||||
" <filter name=\"myFilter\" condition=\":myFilterParam = MY_FILTERED_COLUMN"
|
||||
"\"/>\n"
|
||||
"</set>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:46
|
||||
#. Tag: para
|
||||
#: filters.xml:46
|
||||
#, no-c-format
|
||||
msgid "or, even to both (or multiples of each) at the same time."
|
||||
msgstr ""
|
||||
msgstr "ou mesmo para ambos (ou muitos de cada) ao mesmo tempo."
|
||||
|
||||
#: index.docbook:50
|
||||
msgid "The methods on <literal>Session</literal> are: <literal>enableFilter(String filterName)</literal>, <literal>getEnabledFilter(String filterName)</literal>, and <literal>disableFilter(String filterName)</literal>. By default, filters are <emphasis>not</emphasis> enabled for a given session; they must be explcitly enabled through use of the <literal>Session.enabledFilter()</literal> method, which returns an instance of the <literal>Filter</literal> interface. Using the simple filter defined above, this would look like:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:59
|
||||
msgid "<![CDATA[session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", \"some-value\");]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:61
|
||||
msgid "Note that methods on the org.hibernate.Filter interface do allow the method-chaining common to much of Hibernate."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:65
|
||||
msgid "A full example, using temporal data with an effective record date pattern:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:69
|
||||
#. Tag: para
|
||||
#: filters.xml:50
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<filter-def name=\"effectiveDate\">\n"
|
||||
" <filter-param name=\"asOfDate\" type=\"date\"/>\n"
|
||||
"</filter-def>\n"
|
||||
"\n"
|
||||
"<class name=\"Employee\" ...>\n"
|
||||
"...\n"
|
||||
" <many-to-one name=\"department\" column=\"dept_id\" class=\"Department\"/>\n"
|
||||
" <property name=\"effectiveStartDate\" type=\"date\" column=\"eff_start_dt\"/>\n"
|
||||
" <property name=\"effectiveEndDate\" type=\"date\" column=\"eff_end_dt\"/>\n"
|
||||
"...\n"
|
||||
" <!--\n"
|
||||
" Note that this assumes non-terminal records have an eff_end_dt set to\n"
|
||||
" a max db date for simplicity-sake\n"
|
||||
" -->\n"
|
||||
" <filter name=\"effectiveDate\"\n"
|
||||
" condition=\":asOfDate BETWEEN eff_start_dt and eff_end_dt\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Department\" ...>\n"
|
||||
"...\n"
|
||||
" <set name=\"employees\" lazy=\"true\">\n"
|
||||
" <key column=\"dept_id\"/>\n"
|
||||
" <one-to-many class=\"Employee\"/>\n"
|
||||
" <filter name=\"effectiveDate\"\n"
|
||||
" condition=\":asOfDate BETWEEN eff_start_dt and eff_end_dt\"/>\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
"The methods on <literal>Session</literal> are: <literal>enableFilter(String "
|
||||
"filterName)</literal>, <literal>getEnabledFilter(String filterName)</"
|
||||
"literal>, and <literal>disableFilter(String filterName)</literal>. By "
|
||||
"default, filters are <emphasis>not</emphasis> enabled for a given session; "
|
||||
"they must be explcitly enabled through use of the <literal>Session."
|
||||
"enabledFilter()</literal> method, which returns an instance of the "
|
||||
"<literal>Filter</literal> interface. Using the simple filter defined above, "
|
||||
"this would look like:"
|
||||
msgstr ""
|
||||
"Os métodos na <literal>Session</literal> são: <literal>enableFilter(String "
|
||||
"filterName)</literal>, <literal>getEnabledFilter(String filterName)</"
|
||||
"literal>, e <literal>disableFilter(String filterName)</literal>. Por padrão, "
|
||||
"os filtros não são habilitados dentro de qualquer session; Eles devem ser "
|
||||
"explicitamente habilitados usando o método <literal>Session.enabledFilter()</"
|
||||
"literal>, que retorna uma instância da interface <literal>Filter</literal>. "
|
||||
"Usando o filtro simples definido acima, o código se pareceria com o seguinte:"
|
||||
|
||||
#: index.docbook:71
|
||||
msgid "Then, in order to ensure that you always get back currently effective records, simply enable the filter on the session prior to retrieving employee data:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:76
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:59
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = ...;\n"
|
||||
"session.enabledFilter(\"effectiveDate\").setParameter(\"asOfDate\", new Date());\n"
|
||||
"List results = session.createQuery(\"from Employee as e where e.salary > :targetSalary\")\n"
|
||||
" .setLong(\"targetSalary\", new Long(1000000))\n"
|
||||
" .list();\n"
|
||||
"]]>"
|
||||
"<![CDATA[session.enableFilter(\"myFilter\").setParameter(\"myFilterParam\", "
|
||||
"\"some-value\");]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:78
|
||||
msgid "In the HQL above, even though we only explicitly mentioned a salary constraint on the results, because of the enabled filter the query will return only currently active employees who have a salary greater than a million dollars."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:84
|
||||
msgid "Note: if you plan on using filters with outer joining (either through HQL or load fetching) be careful of the direction of the condition expression. Its safest to set this up for left outer joining; in general, place the parameter first followed by the column name(s) after the operator."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:91
|
||||
msgid "After being defined a filter might be attached to multiple entities and/or collections each with its own condition. That can be tedious when the conditions are the same each time. Thus <literal><filter-def/></literal> allows defining a default condition, either as an attribute or CDATA:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:98
|
||||
#. Tag: para
|
||||
#: filters.xml:61
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</filter-def>\n"
|
||||
"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>]]>"
|
||||
"Note that methods on the org.hibernate.Filter interface do allow the method-"
|
||||
"chaining common to much of Hibernate."
|
||||
msgstr ""
|
||||
"Veja que os métodos da interface org.hibernate.Filter permite o encadeamento "
|
||||
"de funções, comum à maioria das funções do Hibernate."
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:65
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A full example, using temporal data with an effective record date pattern:"
|
||||
msgstr ""
|
||||
"Um exemplo completo, usando dados temporais com um padrão efetivo de "
|
||||
"registro de datas:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:69
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<filter-def name=\"effectiveDate\">\n"
|
||||
" <filter-param name=\"asOfDate\" type=\"date\"/>\n"
|
||||
"</filter-def>\n"
|
||||
"\n"
|
||||
"<class name=\"Employee\" ...>\n"
|
||||
"...\n"
|
||||
" <many-to-one name=\"department\" column=\"dept_id\" class=\"Department\"/"
|
||||
">\n"
|
||||
" <property name=\"effectiveStartDate\" type=\"date\" column=\"eff_start_dt"
|
||||
"\"/>\n"
|
||||
" <property name=\"effectiveEndDate\" type=\"date\" column=\"eff_end_dt\"/"
|
||||
">\n"
|
||||
"...\n"
|
||||
" <!--\n"
|
||||
" Note that this assumes non-terminal records have an eff_end_dt set "
|
||||
"to\n"
|
||||
" a max db date for simplicity-sake\n"
|
||||
" -->\n"
|
||||
" <filter name=\"effectiveDate\"\n"
|
||||
" condition=\":asOfDate BETWEEN eff_start_dt and eff_end_dt\"/>\n"
|
||||
"</class>\n"
|
||||
"\n"
|
||||
"<class name=\"Department\" ...>\n"
|
||||
"...\n"
|
||||
" <set name=\"employees\" lazy=\"true\">\n"
|
||||
" <key column=\"dept_id\"/>\n"
|
||||
" <one-to-many class=\"Employee\"/>\n"
|
||||
" <filter name=\"effectiveDate\"\n"
|
||||
" condition=\":asOfDate BETWEEN eff_start_dt and eff_end_dt\"/"
|
||||
">\n"
|
||||
" </set>\n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:100
|
||||
msgid "This default condition will then be used whenever the filter is attached to something without specifying a condition. Note that this means you can give a specific condition as part of the attachment of the filter which overrides the default condition in that particular case."
|
||||
#. Tag: para
|
||||
#: filters.xml:71
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Then, in order to ensure that you always get back currently effective "
|
||||
"records, simply enable the filter on the session prior to retrieving "
|
||||
"employee data:"
|
||||
msgstr ""
|
||||
"Para garantir que você sempre tenha registro efetivos, simplesmente habilite "
|
||||
"o filtro na session antes de recuperar os dados dos empregados:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:76
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = ...;\n"
|
||||
"session.enabledFilter(\"effectiveDate\").setParameter(\"asOfDate\", new Date"
|
||||
"());\n"
|
||||
"List results = session.createQuery(\"from Employee as e where e.salary > :"
|
||||
"targetSalary\")\n"
|
||||
" .setLong(\"targetSalary\", new Long(1000000))\n"
|
||||
" .list();\n"
|
||||
"]]>"
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
#. Tag: para
|
||||
#: filters.xml:78
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"In the HQL above, even though we only explicitly mentioned a salary "
|
||||
"constraint on the results, because of the enabled filter the query will "
|
||||
"return only currently active employees who have a salary greater than a "
|
||||
"million dollars."
|
||||
msgstr ""
|
||||
"No HQL acima, mesmo que mencionamos apenas uma restrição de salário nos "
|
||||
"resultados, por causa do filtro habilitado, a consulta retornará apenas os "
|
||||
"funcionários ativos cujo salário é maior que um milhão de dólares."
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
#. Tag: para
|
||||
#: filters.xml:84
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note: if you plan on using filters with outer joining (either through HQL or "
|
||||
"load fetching) be careful of the direction of the condition expression. Its "
|
||||
"safest to set this up for left outer joining; in general, place the "
|
||||
"parameter first followed by the column name(s) after the operator."
|
||||
msgstr ""
|
||||
"Nota: se você planeja usar filtros com outer join (por HQL ou por load "
|
||||
"fetching) seja cuidadoso na direção da expressão de condição. É mais seguro "
|
||||
"configura-lo com para um left outer join; geralmente, coloque o parâmetro "
|
||||
"primeiro seguido pelo nome da coluna após o operador."
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:91
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"After being defined a filter might be attached to multiple entities and/or "
|
||||
"collections each with its own condition. That can be tedious when the "
|
||||
"conditions are the same each time. Thus <literal><filter-def/></"
|
||||
"literal> allows defining a default condition, either as an attribute or "
|
||||
"CDATA:"
|
||||
msgstr "translator-credits"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: filters.xml:98
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<filter-def name=\"myFilter\" condition=\"abc > xyz\">...</filter-"
|
||||
"def>\n"
|
||||
"<filter-def name=\"myOtherFilter\">abc=xyz</filter-def>]]>"
|
||||
msgstr ""
|
||||
|
||||
#. Tag: para
|
||||
#: filters.xml:100
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This default condition will then be used whenever the filter is attached to "
|
||||
"something without specifying a condition. Note that this means you can give "
|
||||
"a specific condition as part of the attachment of the filter which overrides "
|
||||
"the default condition in that particular case."
|
||||
msgstr ""
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,68 +1,204 @@
|
|||
#, fuzzy
|
||||
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"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:21
|
||||
"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
|
||||
#: preface.xml:21
|
||||
#, no-c-format
|
||||
msgid "Preface"
|
||||
msgstr ""
|
||||
msgstr "Prefácio"
|
||||
|
||||
#: index.docbook:23
|
||||
msgid "Working with object-oriented software and a relational database can be cumbersome and time consuming in today's enterprise environments. Hibernate is an object/relational mapping tool for Java environments. The term object/relational mapping (ORM) refers to the technique of mapping a data representation from an object model to a relational data model with a SQL-based schema."
|
||||
#. Tag: para
|
||||
#: preface.xml:23
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Working with object-oriented software and a relational database can be "
|
||||
"cumbersome and time consuming in today's enterprise environments. Hibernate "
|
||||
"is an object/relational mapping tool for Java environments. The term object/"
|
||||
"relational mapping (ORM) refers to the technique of mapping a data "
|
||||
"representation from an object model to a relational data model with a SQL-"
|
||||
"based schema."
|
||||
msgstr ""
|
||||
"Trabalhando com software orientado a objetos e banco de dados relacional, "
|
||||
"podemos ter alguns incômodos hoje em dia em ambientes empresariais. "
|
||||
"Hibernate é uma ferramenta que mapeia o objeto/relacional para o ambiente "
|
||||
"Java. O termo de mapeamento de objeto/relacional (ou ORM Object/Relational "
|
||||
"Mapping) se refere a técnica de mapear uma representação de dados de um "
|
||||
"modelo de objeto para dados de modelo relacional com o esquema baseado em SQL"
|
||||
|
||||
#: index.docbook:31
|
||||
msgid "Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities and can significantly reduce development time otherwise spent with manual data handling in SQL and JDBC."
|
||||
#. Tag: para
|
||||
#: preface.xml:31
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate not only takes care of the mapping from Java classes to database "
|
||||
"tables (and from Java data types to SQL data types), but also provides data "
|
||||
"query and retrieval facilities and can significantly reduce development time "
|
||||
"otherwise spent with manual data handling in SQL and JDBC."
|
||||
msgstr ""
|
||||
"O Hibernate não somente cuida do mapeamento de classes em Java para tabelas "
|
||||
"de banco de dados (e de tipos de dados em Java para tipos de dados em SQL), "
|
||||
"como também fornece facilidade de consultas e recuperação de dados, podendo "
|
||||
"também reduzir significantemente o tempo de desenvolvimento gasto com a "
|
||||
"manipulação manual de dados no SQL e JDBC."
|
||||
|
||||
#: index.docbook:38
|
||||
msgid "Hibernates goal is to relieve the developer from 95 percent of common data persistence related programming tasks. Hibernate may not be the best solution for data-centric applications that only use stored-procedures to implement the business logic in the database, it is most useful with object-oriented domain models and business logic in the Java-based middle-tier. However, Hibernate can certainly help you to remove or encapsulate vendor-specific SQL code and will help with the common task of result set translation from a tabular representation to a graph of objects."
|
||||
#. Tag: para
|
||||
#: preface.xml:38
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernates goal is to relieve the developer from 95 percent of common data "
|
||||
"persistence related programming tasks. Hibernate may not be the best "
|
||||
"solution for data-centric applications that only use stored-procedures to "
|
||||
"implement the business logic in the database, it is most useful with object-"
|
||||
"oriented domain models and business logic in the Java-based middle-tier. "
|
||||
"However, Hibernate can certainly help you to remove or encapsulate vendor-"
|
||||
"specific SQL code and will help with the common task of result set "
|
||||
"translation from a tabular representation to a graph of objects."
|
||||
msgstr ""
|
||||
"O objetivo do Hibernate é de aliviar o desenvolvedor de 95 por cento das "
|
||||
"tarefas de programação relacionadas aos dados comuns de persistência. O "
|
||||
"Hibernate talvez não seja a melhor solução para aplicações de dados-data-"
|
||||
"centric que somente usa stored-procedures para implementar a lógica de "
|
||||
"negócio no banco de dados, isto é muito utilizado com o domínio de modelos "
|
||||
"orientado a objetos e lógicas de negócio em camadas do meio (middle-tier) "
|
||||
"baseadas em Java. Porém, o Hibernate poderá certamente ajuda-lo a remover ou "
|
||||
"encapsular o código SQL de um vendedor específico, ajudando também com a "
|
||||
"tarefa comum da tradução do resultado ajustado de uma representação para um "
|
||||
"gráfico de objetos."
|
||||
|
||||
#: index.docbook:48
|
||||
msgid "If you are new to Hibernate and Object/Relational Mapping or even Java, please follow these steps:"
|
||||
#. Tag: para
|
||||
#: preface.xml:48
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"If you are new to Hibernate and Object/Relational Mapping or even Java, "
|
||||
"please follow these steps:"
|
||||
msgstr ""
|
||||
"Se você for novo no Hibernate e no mapeamento Objeto/Relacional, ou até "
|
||||
"mesmo em Java, por favor, siga os seguintes passos."
|
||||
|
||||
#: index.docbook:55
|
||||
msgid "Read <xref linkend=\"tutorial\"/> for a tutorial with step-by-step instructions. The source code for the tutorial is included in the distribution in the <literal>doc/reference/tutorial/</literal> directory."
|
||||
#. Tag: para
|
||||
#: preface.xml:55
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Read <xref linkend=\"tutorial\"/> for a tutorial with step-by-step "
|
||||
"instructions. The source code for the tutorial is included in the "
|
||||
"distribution in the <literal>doc/reference/tutorial/</literal> directory."
|
||||
msgstr ""
|
||||
"Leia <xref linkend=\"tutorial\"/> para um tutorial com instruções passo-a-"
|
||||
"passo. O código fonte para do tutorial está incluído na distribuição no "
|
||||
"diretório <literal>doc/reference/tutorial/</literal>."
|
||||
|
||||
#: index.docbook:63
|
||||
msgid "Read <xref linkend=\"architecture\"/> to understand the environments where Hibernate can be used."
|
||||
#. Tag: para
|
||||
#: preface.xml:63
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Read <xref linkend=\"architecture\"/> to understand the environments where "
|
||||
"Hibernate can be used."
|
||||
msgstr ""
|
||||
"Leia o <xref linkend=\"architecture\"/> para entender o ambiente onde o "
|
||||
"Hibernate pode ser utilizado."
|
||||
|
||||
#: index.docbook:69
|
||||
msgid "Have a look at the <literal>eg/</literal> directory in the Hibernate distribution, it contains a simple standalone application. Copy your JDBC driver to the <literal>lib/</literal> directory and edit <literal>etc/hibernate.properties</literal>, specifying correct values for your database. From a command prompt in the distribution directory, type <literal>ant eg</literal> (using Ant), or under Windows, type <literal>build eg</literal>."
|
||||
#. Tag: para
|
||||
#: preface.xml:69
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Have a look at the <literal>eg/</literal> directory in the Hibernate "
|
||||
"distribution, it contains a simple standalone application. Copy your JDBC "
|
||||
"driver to the <literal>lib/</literal> directory and edit <literal>etc/"
|
||||
"hibernate.properties</literal>, specifying correct values for your database. "
|
||||
"From a command prompt in the distribution directory, type <literal>ant eg</"
|
||||
"literal> (using Ant), or under Windows, type <literal>build eg</literal>."
|
||||
msgstr ""
|
||||
"Dê uma olhada no diretório de exemplo <literal>eg/</literal> da distribuição "
|
||||
"do Hibernate, ele contém uma simples aplicação standalone. Copie seu driver "
|
||||
"JDBC para o diretório <literal>lib/</literal> e edite o arquivo <literal>etc/"
|
||||
"hibernate.properties</literal>, especificando corretamente os valores para "
|
||||
"seu banco de dados. Usando o prompt de commando no diretorio de "
|
||||
"distribuicao, digite <literal>ant eg</literal> (usando Ant), ou no Windows, "
|
||||
"digite <literal>build eg</literal>."
|
||||
|
||||
#: index.docbook:80
|
||||
msgid "Use this reference documentation as your primary source of information. Consider reading <emphasis>Java Persistence with Hibernate</emphasis> (http://www.manning.com/bauer2) if you need more help with application design or if you prefer a step-by-step tutorial. Also visit http://caveatemptor.hibernate.org and download the example application for Java Persistence with Hibernate."
|
||||
#. Tag: para
|
||||
#: preface.xml:80
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Use this reference documentation as your primary source of information. "
|
||||
"Consider reading <emphasis>Java Persistence with Hibernate</emphasis> "
|
||||
"(http://www.manning.com/bauer2) if you need more help with application "
|
||||
"design or if you prefer a step-by-step tutorial. Also visit http://"
|
||||
"caveatemptor.hibernate.org and download the example application for Java "
|
||||
"Persistence with Hibernate."
|
||||
msgstr ""
|
||||
"Use esta documentação de referencia como sua fonte primaria de informação. "
|
||||
"Considere ler também o livro <emphasis>Java Persistence with Hibernate</"
|
||||
"emphasis> (http://www.manning.com/bauer2) caso você precise de mais ajuda "
|
||||
"com o desenvolvimento de aplicações ou caso prefira um tutorial passo-a-"
|
||||
"passo. Também visite o site http://caveatemptor.hibernate.org e faça o "
|
||||
"download da aplicação de exemplo do Java Persistence with Hibernate."
|
||||
|
||||
#: index.docbook:90
|
||||
#. Tag: para
|
||||
#: preface.xml:90
|
||||
#, no-c-format
|
||||
msgid "FAQs are answered on the Hibernate website."
|
||||
msgstr ""
|
||||
"FAQs (perguntas feitas com mais freqüência) estão respondidas no site do "
|
||||
"Hibernate"
|
||||
|
||||
#: index.docbook:95
|
||||
msgid "Third party demos, examples, and tutorials are linked on the Hibernate website."
|
||||
#. Tag: para
|
||||
#: preface.xml:95
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Third party demos, examples, and tutorials are linked on the Hibernate "
|
||||
"website."
|
||||
msgstr ""
|
||||
"Demonstrações, exemplos e tutorials estão disponíveis no site do Hibernate."
|
||||
|
||||
#: index.docbook:101
|
||||
msgid "The Community Area on the Hibernate website is a good resource for design patterns and various integration solutions (Tomcat, JBoss AS, Struts, EJB, etc.)."
|
||||
#. Tag: para
|
||||
#: preface.xml:101
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"The Community Area on the Hibernate website is a good resource for design "
|
||||
"patterns and various integration solutions (Tomcat, JBoss AS, Struts, EJB, "
|
||||
"etc.)."
|
||||
msgstr ""
|
||||
"A Área da comunidade no site do Hibernate é uma boa fonte de recursos para "
|
||||
"padrões de projeto e várias soluções de integração (Tomcat, JBoss AS, "
|
||||
"Struts, EJB, etc.)."
|
||||
|
||||
#: index.docbook:109
|
||||
msgid "If you have questions, use the user forum linked on the Hibernate website. We also provide a JIRA issue trackings system for bug reports and feature requests. If you are interested in the development of Hibernate, join the developer mailing list. If you are interested in translating this documentation into your language, contact us on the developer mailing list."
|
||||
#. Tag: para
|
||||
#: preface.xml:109
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"If you have questions, use the user forum linked on the Hibernate website. "
|
||||
"We also provide a JIRA issue trackings system for bug reports and feature "
|
||||
"requests. If you are interested in the development of Hibernate, join the "
|
||||
"developer mailing list. If you are interested in translating this "
|
||||
"documentation into your language, contact us on the developer mailing list."
|
||||
msgstr ""
|
||||
"Caso você tenha dúvidas, use o fórum dos usuários encontrado no site do "
|
||||
"Hibernate. Nós também fornecemos um sistema para controle de bugs (JIRA) "
|
||||
"para relatórios de erros e requisições de features. Se você está interessado "
|
||||
"no desenvolvimento do Hibernate, junte-se a lista de e-mail dos "
|
||||
"desenvolvedores."
|
||||
|
||||
#: index.docbook:117
|
||||
msgid "Commercial development support, production support, and training for Hibernate is available through JBoss Inc. (see http://www.hibernate.org/SupportTraining/). Hibernate is a Professional Open Source project and a critical component of the JBoss Enterprise Middleware System (JEMS) suite of products."
|
||||
#. Tag: para
|
||||
#: preface.xml:117
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Commercial development support, production support, and training for "
|
||||
"Hibernate is available through JBoss Inc. (see http://www.hibernate.org/"
|
||||
"SupportTraining/). Hibernate is a Professional Open Source project and a "
|
||||
"critical component of the JBoss Enterprise Middleware System (JEMS) suite of "
|
||||
"products."
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
"Suporte comercial de desenvolvimento, suporte de produção e treinamento para "
|
||||
"o Hibernate está disponível através do JBoss Inc. (veja http://www.hibernate."
|
||||
"org/SupportTraining). O Hibernate é um Projeto Profissional de Código Aberto "
|
||||
"e um componente crítico da suíte de produtos JBoss Enterprise Middleware "
|
||||
"System (JEMS)."
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,284 +1,456 @@
|
|||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
|
||||
"POT-Creation-Date: 2007-10-25 07:48+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
#: index.docbook:5
|
||||
"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
|
||||
#: xml.xml:5
|
||||
#, no-c-format
|
||||
msgid "XML Mapping"
|
||||
msgstr ""
|
||||
msgstr "Mapeamento XML"
|
||||
|
||||
#: index.docbook:7
|
||||
msgid "Note that this is an experimental feature in Hibernate 3.0 and is under extremely active development."
|
||||
#. Tag: emphasis
|
||||
#: xml.xml:7
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Note that this is an experimental feature in Hibernate 3.0 and is under "
|
||||
"extremely active development."
|
||||
msgstr ""
|
||||
"Note that this is an experimental feature in Hibernate 3.0 and is under "
|
||||
"extremely active development. Veja que essa é uma feature experimental no "
|
||||
"Hibernate 3.0 e o desenvolvimento esta bastante ativo."
|
||||
|
||||
#: index.docbook:13
|
||||
#. Tag: title
|
||||
#: xml.xml:13
|
||||
#, no-c-format
|
||||
msgid "Working with XML data"
|
||||
msgstr ""
|
||||
msgstr "Trabalhando com dados em XML"
|
||||
|
||||
#: index.docbook:15
|
||||
msgid "Hibernate lets you work with persistent XML data in much the same way you work with persistent POJOs. A parsed XML tree can be thought of as just another way to represent the relational data at the object level, instead of POJOs."
|
||||
#. Tag: para
|
||||
#: xml.xml:15
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate lets you work with persistent XML data in much the same way you "
|
||||
"work with persistent POJOs. A parsed XML tree can be thought of as just "
|
||||
"another way to represent the relational data at the object level, instead of "
|
||||
"POJOs."
|
||||
msgstr ""
|
||||
"O Hibernate permite que se trabalhe com dados persistentes em XML quase da "
|
||||
"mesma maneira como você trabalhar com POJOs persistentes. Uma árvore XML "
|
||||
"parseada, pode ser imaginada como apenas uma maneira de representar os dados "
|
||||
"relacionais como objetos, ao invés dos POJOs."
|
||||
|
||||
#: index.docbook:22
|
||||
msgid "Hibernate supports dom4j as API for manipulating XML trees. You can write queries that retrieve dom4j trees from the database and have any modification you make to the tree automatically synchronized to the database. You can even take an XML document, parse it using dom4j, and write it to the database with any of Hibernate's basic operations: <literal>persist(), saveOrUpdate(), merge(), delete(), replicate()</literal> (merging is not yet supported)."
|
||||
#. Tag: para
|
||||
#: xml.xml:22
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Hibernate supports dom4j as API for manipulating XML trees. You can write "
|
||||
"queries that retrieve dom4j trees from the database and have any "
|
||||
"modification you make to the tree automatically synchronized to the "
|
||||
"database. You can even take an XML document, parse it using dom4j, and write "
|
||||
"it to the database with any of Hibernate's basic operations: <literal>persist"
|
||||
"(), saveOrUpdate(), merge(), delete(), replicate()</literal> (merging is not "
|
||||
"yet supported)."
|
||||
msgstr ""
|
||||
"O Hibernate suporta a API dom4j para manipular árvores XML. Você pode "
|
||||
"escrever queries que retornem árvores dom4j do banco de dados e "
|
||||
"automaticamente sincronizar com o banco de dados qualquer modificação feita "
|
||||
"nessas árvores. Você pode até mesmo pegar um documento XML, parsear usando o "
|
||||
"dom4j, e escrever as alterações no banco de dados usando quaisquer operações "
|
||||
"básicas do Hibernate: <literal>persist(), saveOrUpdate(),merge(), delete(), "
|
||||
"replicate()</literal> (merging ainda não é suportado)"
|
||||
|
||||
#: index.docbook:32
|
||||
msgid "This feature has many applications including data import/export, externalization of entity data via JMS or SOAP and XSLT-based reporting."
|
||||
#. Tag: para
|
||||
#: xml.xml:32
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This feature has many applications including data import/export, "
|
||||
"externalization of entity data via JMS or SOAP and XSLT-based reporting."
|
||||
msgstr ""
|
||||
"Essa funcionalidade tem várias aplicações incluindo importação/exportação de "
|
||||
"dados, externalização de dados de entidade via JMS or SOAP e relatórios "
|
||||
"usando XSLT."
|
||||
|
||||
#: index.docbook:37
|
||||
msgid "A single mapping may be used to simultaneously map properties of a class and nodes of an XML document to the database, or, if there is no class to map, it may be used to map just the XML."
|
||||
#. Tag: para
|
||||
#: xml.xml:37
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"A single mapping may be used to simultaneously map properties of a class and "
|
||||
"nodes of an XML document to the database, or, if there is no class to map, "
|
||||
"it may be used to map just the XML."
|
||||
msgstr ""
|
||||
"Um mapeamento simples pode ser usado para simultaneamente mapear "
|
||||
"propriedades da classe e nós de um documento XML para um banco de dados ou, "
|
||||
"se não houver classe para mapear, pode ser usado simplesmente para mapear o "
|
||||
"XML."
|
||||
|
||||
#: index.docbook:44
|
||||
#. Tag: title
|
||||
#: xml.xml:44
|
||||
#, no-c-format
|
||||
msgid "Specifying XML and class mapping together"
|
||||
msgstr ""
|
||||
"Especificando o mapeamento de uma classe e de um arquivo XML simultaneamente"
|
||||
|
||||
#: index.docbook:46
|
||||
#. Tag: para
|
||||
#: xml.xml:46
|
||||
#, no-c-format
|
||||
msgid "Here is an example of mapping a POJO and XML simultaneously:"
|
||||
msgstr ""
|
||||
msgstr "Segue um exemplo de como mapear um POJO e um XML ao mesmo tempo:"
|
||||
|
||||
#: index.docbook:50
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:50
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Account\" \n"
|
||||
" table=\"ACCOUNTS\" \n"
|
||||
" node=\"account\">\n"
|
||||
" \n"
|
||||
" <id name=\"accountId\" \n"
|
||||
" column=\"ACCOUNT_ID\" \n"
|
||||
" node=\"@id\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"customer\" \n"
|
||||
" column=\"CUSTOMER_ID\" \n"
|
||||
" node=\"customer/@id\" \n"
|
||||
" embed-xml=\"false\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"balance\" \n"
|
||||
" column=\"BALANCE\" \n"
|
||||
" node=\"balance\"/>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
"<![CDATA[<class name=\"Account\" \n"
|
||||
" table=\"ACCOUNTS\" \n"
|
||||
" node=\"account\">\n"
|
||||
" \n"
|
||||
" <id name=\"accountId\" \n"
|
||||
" column=\"ACCOUNT_ID\" \n"
|
||||
" node=\"@id\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"customer\" \n"
|
||||
" column=\"CUSTOMER_ID\" \n"
|
||||
" node=\"customer/@id\" \n"
|
||||
" embed-xml=\"false\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"balance\" \n"
|
||||
" column=\"BALANCE\" \n"
|
||||
" node=\"balance\"/>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:54
|
||||
#. Tag: title
|
||||
#: xml.xml:54
|
||||
#, no-c-format
|
||||
msgid "Specifying only an XML mapping"
|
||||
msgstr ""
|
||||
msgstr "Especificando somente um mapeamento XML"
|
||||
|
||||
#: index.docbook:56
|
||||
#. Tag: para
|
||||
#: xml.xml:56
|
||||
#, no-c-format
|
||||
msgid "Here is an example where there is no POJO class:"
|
||||
msgstr ""
|
||||
msgstr "Segue um exemplo que não contém uma classe POJO:"
|
||||
|
||||
#: index.docbook:60
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:60
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class entity-name=\"Account\" \n"
|
||||
" table=\"ACCOUNTS\" \n"
|
||||
" node=\"account\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\" \n"
|
||||
" column=\"ACCOUNT_ID\" \n"
|
||||
" node=\"@id\" \n"
|
||||
" type=\"string\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"customerId\" \n"
|
||||
" column=\"CUSTOMER_ID\" \n"
|
||||
" node=\"customer/@id\" \n"
|
||||
" embed-xml=\"false\" \n"
|
||||
" entity-name=\"Customer\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"balance\" \n"
|
||||
" column=\"BALANCE\" \n"
|
||||
" node=\"balance\" \n"
|
||||
" type=\"big_decimal\"/>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
"<![CDATA[<class entity-name=\"Account\" \n"
|
||||
" table=\"ACCOUNTS\" \n"
|
||||
" node=\"account\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\" \n"
|
||||
" column=\"ACCOUNT_ID\" \n"
|
||||
" node=\"@id\" \n"
|
||||
" type=\"string\"/>\n"
|
||||
" \n"
|
||||
" <many-to-one name=\"customerId\" \n"
|
||||
" column=\"CUSTOMER_ID\" \n"
|
||||
" node=\"customer/@id\" \n"
|
||||
" embed-xml=\"false\" \n"
|
||||
" entity-name=\"Customer\"/>\n"
|
||||
" \n"
|
||||
" <property name=\"balance\" \n"
|
||||
" column=\"BALANCE\" \n"
|
||||
" node=\"balance\" \n"
|
||||
" type=\"big_decimal\"/>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:62
|
||||
msgid "This mapping allows you to access the data as a dom4j tree, or as a graph of property name/value pairs (java <literal>Map</literal>s). The property names are purely logical constructs that may be referred to in HQL queries."
|
||||
#. Tag: para
|
||||
#: xml.xml:62
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"This mapping allows you to access the data as a dom4j tree, or as a graph of "
|
||||
"property name/value pairs (java <literal>Map</literal>s). The property names "
|
||||
"are purely logical constructs that may be referred to in HQL queries."
|
||||
msgstr ""
|
||||
"Esse mapeamento permite que você acesse os dados como uma árvore dom4j ou um "
|
||||
"grafo de de pares nome de propriedade/valor (<literal>Map</literal>s do "
|
||||
"Java). Os nomes de propriedades são somente construções lógicas que podem "
|
||||
"ser referenciadas em consultas HQL."
|
||||
|
||||
#: index.docbook:73
|
||||
#. Tag: title
|
||||
#: xml.xml:73
|
||||
#, no-c-format
|
||||
msgid "XML mapping metadata"
|
||||
msgstr ""
|
||||
msgstr "Mapeando metadados com XML"
|
||||
|
||||
#: index.docbook:75
|
||||
msgid "Many Hibernate mapping elements accept the <literal>node</literal> attribute. This let's you specify the name of an XML attribute or element that holds the property or entity data. The format of the <literal>node</literal> attribute must be one of the following:"
|
||||
#. Tag: para
|
||||
#: xml.xml:75
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"Many Hibernate mapping elements accept the <literal>node</literal> "
|
||||
"attribute. This let's you specify the name of an XML attribute or element "
|
||||
"that holds the property or entity data. The format of the <literal>node</"
|
||||
"literal> attribute must be one of the following:"
|
||||
msgstr ""
|
||||
"Muitos elementos do mapeamento do Hibernate aceitam o atributo "
|
||||
"<literal>node</literal>. Por meio dele, você pode especificar o nome de um "
|
||||
"atributo ou elemento XML que contém a propriedade ou os dados da entidade. O "
|
||||
"formato do atributo <literal>node</literal> deve ser o seguinte:"
|
||||
|
||||
#: index.docbook:84
|
||||
#. Tag: para
|
||||
#: xml.xml:84
|
||||
#, no-c-format
|
||||
msgid "<literal>\"element-name\"</literal> - map to the named XML element"
|
||||
msgstr ""
|
||||
"<literal>\"element-name\"</literal> - mapeia para o elemento XML com "
|
||||
"determinado nome"
|
||||
|
||||
#: index.docbook:87
|
||||
#. Tag: para
|
||||
#: xml.xml:87
|
||||
#, no-c-format
|
||||
msgid "<literal>\"@attribute-name\"</literal> - map to the named XML attribute"
|
||||
msgstr ""
|
||||
"<literal>\"@attribute-name\"</literal> - mapeia para o atributo XML com "
|
||||
"determinado nome"
|
||||
|
||||
#: index.docbook:90
|
||||
#. Tag: para
|
||||
#: xml.xml:90
|
||||
#, no-c-format
|
||||
msgid "<literal>\".\"</literal> - map to the parent element"
|
||||
msgstr ""
|
||||
msgstr "<literal>\".\"</literal> - mapeia para o elemento pai"
|
||||
|
||||
#: index.docbook:93
|
||||
msgid "<literal>\"element-name/@attribute-name\"</literal> - map to the named attribute of the named element"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:100
|
||||
msgid "For collections and single valued associations, there is an additional <literal>embed-xml</literal> attribute. If <literal>embed-xml=\"true\"</literal>, the default, the XML tree for the associated entity (or collection of value type) will be embedded directly in the XML tree for the entity that owns the association. Otherwise, if <literal>embed-xml=\"false\"</literal>, then only the referenced identifier value will appear in the XML for single point associations and collections will simply not appear at all."
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:110
|
||||
msgid "You should be careful not to leave <literal>embed-xml=\"true\"</literal> for too many associations, since XML does not deal well with circularity!"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:115
|
||||
#. Tag: para
|
||||
#: xml.xml:93
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Customer\" \n"
|
||||
" table=\"CUSTOMER\" \n"
|
||||
" node=\"customer\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\" \n"
|
||||
" column=\"CUST_ID\" \n"
|
||||
" node=\"@id\"/>\n"
|
||||
" \n"
|
||||
" <map name=\"accounts\" \n"
|
||||
" node=\".\" \n"
|
||||
" embed-xml=\"true\">\n"
|
||||
" <key column=\"CUSTOMER_ID\" \n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" <map-key column=\"SHORT_DESC\" \n"
|
||||
" node=\"@short-desc\" \n"
|
||||
" type=\"string\"/>\n"
|
||||
" <one-to-many entity-name=\"Account\"\n"
|
||||
" embed-xml=\"false\" \n"
|
||||
" node=\"account\"/>\n"
|
||||
" </map>\n"
|
||||
" \n"
|
||||
" <component name=\"name\" \n"
|
||||
" node=\"name\">\n"
|
||||
" <property name=\"firstName\" \n"
|
||||
" node=\"first-name\"/>\n"
|
||||
" <property name=\"initial\" \n"
|
||||
" node=\"initial\"/>\n"
|
||||
" <property name=\"lastName\" \n"
|
||||
" node=\"last-name\"/>\n"
|
||||
" </component>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
"<literal>\"element-name/@attribute-name\"</literal> - map to the named "
|
||||
"attribute of the named element"
|
||||
msgstr ""
|
||||
"<literal>\"element-name/@attribute-name\"</literal> - mapeia para para o "
|
||||
"atributo com determinado nome do elemento com determinado nome"
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:100
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"For collections and single valued associations, there is an additional "
|
||||
"<literal>embed-xml</literal> attribute. If <literal>embed-xml=\"true\"</"
|
||||
"literal>, the default, the XML tree for the associated entity (or collection "
|
||||
"of value type) will be embedded directly in the XML tree for the entity that "
|
||||
"owns the association. Otherwise, if <literal>embed-xml=\"false\"</literal>, "
|
||||
"then only the referenced identifier value will appear in the XML for single "
|
||||
"point associations and collections will simply not appear at all."
|
||||
msgstr ""
|
||||
"Para coleções e associações simples, existe o atributo adicional "
|
||||
"<literal>embed-xml</literal>. Se o atributo <literal>embed-xml=\"true\"</"
|
||||
"literal>, que é o valor padrão, a árvore XML para a entidade associada (ou "
|
||||
"coleção de determinado tipo de valor) será embutida diretamente na árvore "
|
||||
"XML que contém a associação. Por outro lado, se <literal>embed-xml=\"false"
|
||||
"\"</literal>, então apenas o valor do identificador referenciado irá "
|
||||
"aparecer no XML para associações simples e coleções simplesmentenão irão "
|
||||
"aparecer."
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:110
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"You should be careful not to leave <literal>embed-xml=\"true\"</literal> for "
|
||||
"too many associations, since XML does not deal well with circularity!"
|
||||
msgstr ""
|
||||
"Você precisa tomar cuidado em não deixar o<literal>embed-xml=\"true\"</"
|
||||
"literal> para muitas associações, pois o XML não suporta bem referências "
|
||||
"circulares."
|
||||
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:115
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<class name=\"Customer\" \n"
|
||||
" table=\"CUSTOMER\" \n"
|
||||
" node=\"customer\">\n"
|
||||
" \n"
|
||||
" <id name=\"id\" \n"
|
||||
" column=\"CUST_ID\" \n"
|
||||
" node=\"@id\"/>\n"
|
||||
" \n"
|
||||
" <map name=\"accounts\" \n"
|
||||
" node=\".\" \n"
|
||||
" embed-xml=\"true\">\n"
|
||||
" <key column=\"CUSTOMER_ID\" \n"
|
||||
" not-null=\"true\"/>\n"
|
||||
" <map-key column=\"SHORT_DESC\" \n"
|
||||
" node=\"@short-desc\" \n"
|
||||
" type=\"string\"/>\n"
|
||||
" <one-to-many entity-name=\"Account\"\n"
|
||||
" embed-xml=\"false\" \n"
|
||||
" node=\"account\"/>\n"
|
||||
" </map>\n"
|
||||
" \n"
|
||||
" <component name=\"name\" \n"
|
||||
" node=\"name\">\n"
|
||||
" <property name=\"firstName\" \n"
|
||||
" node=\"first-name\"/>\n"
|
||||
" <property name=\"initial\" \n"
|
||||
" node=\"initial\"/>\n"
|
||||
" <property name=\"lastName\" \n"
|
||||
" node=\"last-name\"/>\n"
|
||||
" </component>\n"
|
||||
" \n"
|
||||
" ...\n"
|
||||
" \n"
|
||||
"</class>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:117
|
||||
msgid "in this case, we have decided to embed the collection of account ids, but not the actual account data. The following HQL query:"
|
||||
#. Tag: para
|
||||
#: xml.xml:117
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"in this case, we have decided to embed the collection of account ids, but "
|
||||
"not the actual account data. The following HQL query:"
|
||||
msgstr ""
|
||||
"Nesse caso, decidimos embutir a colenção de account ids, e não os dados de "
|
||||
"accounts. A query HQL a seguir:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:122
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[from Customer c left join fetch c.accounts where c.lastName like :"
|
||||
"lastName]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:122
|
||||
msgid "<![CDATA[from Customer c left join fetch c.accounts where c.lastName like :lastName]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:124
|
||||
#. Tag: para
|
||||
#: xml.xml:124
|
||||
#, no-c-format
|
||||
msgid "Would return datasets such as this:"
|
||||
msgstr ""
|
||||
msgstr "Retornaria um conjunto de dados como esse:"
|
||||
|
||||
#: index.docbook:128
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:128
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<customer id=\"123456789\">\n"
|
||||
" <account short-desc=\"Savings\">987632567</account>\n"
|
||||
" <account short-desc=\"Credit Card\">985612323</account>\n"
|
||||
" <name>\n"
|
||||
" <first-name>Gavin</first-name>\n"
|
||||
" <initial>A</initial>\n"
|
||||
" <last-name>King</last-name>\n"
|
||||
" </name>\n"
|
||||
" ...\n"
|
||||
"</customer>]]>"
|
||||
"<![CDATA[<customer id=\"123456789\">\n"
|
||||
" <account short-desc=\"Savings\">987632567</account>\n"
|
||||
" <account short-desc=\"Credit Card\">985612323</account>\n"
|
||||
" <name>\n"
|
||||
" <first-name>Gavin</first-name>\n"
|
||||
" <initial>A</initial>\n"
|
||||
" <last-name>King</last-name>\n"
|
||||
" </name>\n"
|
||||
" ...\n"
|
||||
"</customer>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:130
|
||||
msgid "If you set <literal>embed-xml=\"true\"</literal> on the <literal><one-to-many></literal> mapping, the data might look more like this:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:135
|
||||
#. Tag: para
|
||||
#: xml.xml:130
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<customer id=\"123456789\">\n"
|
||||
" <account id=\"987632567\" short-desc=\"Savings\">\n"
|
||||
" <customer id=\"123456789\"/>\n"
|
||||
" <balance>100.29</balance>\n"
|
||||
" </account>\n"
|
||||
" <account id=\"985612323\" short-desc=\"Credit Card\">\n"
|
||||
" <customer id=\"123456789\"/>\n"
|
||||
" <balance>-2370.34</balance>\n"
|
||||
" </account>\n"
|
||||
" <name>\n"
|
||||
" <first-name>Gavin</first-name>\n"
|
||||
" <initial>A</initial>\n"
|
||||
" <last-name>King</last-name>\n"
|
||||
" </name>\n"
|
||||
" ...\n"
|
||||
"</customer>]]>"
|
||||
"If you set <literal>embed-xml=\"true\"</literal> on the <literal><one-to-"
|
||||
"many></literal> mapping, the data might look more like this:"
|
||||
msgstr ""
|
||||
"Se você setar <literal>embed-xml=\"true\"</literal> em um mapeamento "
|
||||
"<literal><one-to-many></literal>, os dados se pareceriam com o "
|
||||
"seguinte:"
|
||||
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:135
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[<customer id=\"123456789\">\n"
|
||||
" <account id=\"987632567\" short-desc=\"Savings\">\n"
|
||||
" <customer id=\"123456789\"/>\n"
|
||||
" <balance>100.29</balance>\n"
|
||||
" </account>\n"
|
||||
" <account id=\"985612323\" short-desc=\"Credit Card\">\n"
|
||||
" <customer id=\"123456789\"/>\n"
|
||||
" <balance>-2370.34</balance>\n"
|
||||
" </account>\n"
|
||||
" <name>\n"
|
||||
" <first-name>Gavin</first-name>\n"
|
||||
" <initial>A</initial>\n"
|
||||
" <last-name>King</last-name>\n"
|
||||
" </name>\n"
|
||||
" ...\n"
|
||||
"</customer>]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:141
|
||||
#. Tag: title
|
||||
#: xml.xml:141
|
||||
#, no-c-format
|
||||
msgid "Manipulating XML data"
|
||||
msgstr ""
|
||||
msgstr "Manipulando dados em XML"
|
||||
|
||||
#: index.docbook:143
|
||||
msgid "Let's rearead and update XML documents in the application. We do this by obtaining a dom4j session:"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:148
|
||||
#. Tag: para
|
||||
#: xml.xml:143
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Document doc = ....;\n"
|
||||
" \n"
|
||||
"Session session = factory.openSession();\n"
|
||||
"Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"List results = dom4jSession\n"
|
||||
" .createQuery(\"from Customer c left join fetch c.accounts where c.lastName like :lastName\")\n"
|
||||
" .list();\n"
|
||||
"for ( int i=0; i<results.size(); i++ ) {\n"
|
||||
" //add the customer data to the XML document\n"
|
||||
" Element customer = (Element) results.get(i);\n"
|
||||
" doc.add(customer);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"Let's rearead and update XML documents in the application. We do this by "
|
||||
"obtaining a dom4j session:"
|
||||
msgstr ""
|
||||
"Vamos reler e atualizar documentos em XML em nossa aplicação. Nós fazemos "
|
||||
"isso obtendo uma session do dom4j:"
|
||||
|
||||
#: index.docbook:150
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:148
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = factory.openSession();\n"
|
||||
"Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"Element cust = (Element) dom4jSession.get(\"Customer\", customerId);\n"
|
||||
"for ( int i=0; i<results.size(); i++ ) {\n"
|
||||
" Element customer = (Element) results.get(i);\n"
|
||||
" //change the customer name in the XML and database\n"
|
||||
" Element name = customer.element(\"name\");\n"
|
||||
" name.element(\"first-name\").setText(firstName);\n"
|
||||
" name.element(\"initial\").setText(initial);\n"
|
||||
" name.element(\"last-name\").setText(lastName);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
"<![CDATA[Document doc = ....;\n"
|
||||
" \n"
|
||||
"Session session = factory.openSession();\n"
|
||||
"Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"List results = dom4jSession\n"
|
||||
" .createQuery(\"from Customer c left join fetch c.accounts where c."
|
||||
"lastName like :lastName\")\n"
|
||||
" .list();\n"
|
||||
"for ( int i=0; i<results.size(); i++ ) {\n"
|
||||
" //add the customer data to the XML document\n"
|
||||
" Element customer = (Element) results.get(i);\n"
|
||||
" doc.add(customer);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
#: index.docbook:152
|
||||
msgid "It is extremely useful to combine this feature with Hibernate's <literal>replicate()</literal> operation to implement XML-based data import/export."
|
||||
#. Tag: programlisting
|
||||
#: xml.xml:150
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"<![CDATA[Session session = factory.openSession();\n"
|
||||
"Session dom4jSession = session.getSession(EntityMode.DOM4J);\n"
|
||||
"Transaction tx = session.beginTransaction();\n"
|
||||
"\n"
|
||||
"Element cust = (Element) dom4jSession.get(\"Customer\", customerId);\n"
|
||||
"for ( int i=0; i<results.size(); i++ ) {\n"
|
||||
" Element customer = (Element) results.get(i);\n"
|
||||
" //change the customer name in the XML and database\n"
|
||||
" Element name = customer.element(\"name\");\n"
|
||||
" name.element(\"first-name\").setText(firstName);\n"
|
||||
" name.element(\"initial\").setText(initial);\n"
|
||||
" name.element(\"last-name\").setText(lastName);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"tx.commit();\n"
|
||||
"session.close();]]>"
|
||||
msgstr ""
|
||||
|
||||
msgid "ROLES_OF_TRANSLATORS"
|
||||
msgstr "<!--TRANS:ROLES_OF_TRANSLATORS-->"
|
||||
|
||||
msgid "CREDIT_FOR_TRANSLATORS"
|
||||
msgstr "<!--TRANS:CREDIT_FOR_TRANSLATORS-->"
|
||||
|
||||
#. Tag: para
|
||||
#: xml.xml:152
|
||||
#, no-c-format
|
||||
msgid ""
|
||||
"It is extremely useful to combine this feature with Hibernate's "
|
||||
"<literal>replicate()</literal> operation to implement XML-based data import/"
|
||||
"export."
|
||||
msgstr ""
|
||||
"É extremamente útil combinar essa funcionalidade com a operação "
|
||||
"<literal>replicate()</literal> do Hibernate para implementar importação/"
|
||||
"exportação baseadas em XML."
|
||||
|
|
Loading…
Reference in New Issue