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

Hibernate example source code file (performance.po)

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

Java - Hibernate tags/keywords

a, cache, hibernate, hibernate, o, o, por, se, tag, tag, the, this, this, you

The Hibernate performance.po source code

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

#. Tag: title
#: performance.xml:31
#, no-c-format
msgid "Improving performance"
msgstr "Aumentando o desempenho"

#. Tag: title
#: performance.xml:34
#, no-c-format
msgid "Fetching strategies"
msgstr "Estratégias de Busca "

#. Tag: para
#: performance.xml:36
#, no-c-format
msgid ""
"Hibernate uses a <emphasis>fetching strategy to retrieve "
"associated objects if the application needs to navigate the association. "
"Fetch strategies can be declared in the O/R mapping metadata, or over-ridden "
"by a particular HQL or <literal>Criteria query."
msgstr ""
"Uma <emphasis>estratégia de busca é a estratégia que o Hibernate "
"irá usar para recuperar objetos associados se a aplicação precisar navegar "
"pela associação. Estratégias de Busca podem ser declaradas nos metadados de "
"mapeamento O/R, ou sobrescritos por uma consulta HQL ou consulta com "
"<literal>Criteria. "

#. Tag: para
#: performance.xml:42
#, no-c-format
msgid "Hibernate3 defines the following fetching strategies:"
msgstr "Hibernate3 define as seguintes estratégias de busca:"

#. Tag: para
#: performance.xml:46
#, no-c-format
msgid ""
"<emphasis>Join fetching: Hibernate retrieves the associated "
"instance or collection in the same <literal>SELECT, using an "
"<literal>OUTER JOIN."
msgstr ""
"<emphasis>Join fetching - o Hibernate busca o objeto ou coleção "
"associada no mesmo <literal>SELECT, usando um OUTER JOIN: a second SELECT is "
"used to retrieve the associated entity or collection. Unless you explicitly "
"disable lazy fetching by specifying <literal>lazy=\"false\", this "
"second select will only be executed when you access the association."
msgstr ""
"<emphasis>Select fetching - um segundo SELECT "
"é usado para buscar a entidade ou coleção associada. A menos que você "
"desabilite a busca lazy, especificando <literal>lazy=\"false\", "
"esse segundo SELECT será executado apenas quando você acessar a associação. "

#. Tag: para
#: performance.xml:61
#, no-c-format
msgid ""
"<emphasis>Subselect fetching: a second SELECT "
"is used to retrieve the associated collections for all entities retrieved in "
"a previous query or fetch. Unless you explicitly disable lazy fetching by "
"specifying <literal>lazy=\"false\", this second select will only "
"be executed when you access the association."
msgstr ""
"<emphasis>Subselect fetching - um segundo SELECT, "
"esse segundo SELECT será executado apenas quando você acessar a associação.  "

#. Tag: para
#: performance.xml:70
#, no-c-format
msgid ""
"<emphasis>Batch fetching: an optimization strategy for select "
"fetching. Hibernate retrieves a batch of entity instances or collections in "
"a single <literal>SELECT by specifying a list of primary or "
"foreign keys."
msgstr ""
"<emphasis>Batch fetching - uma opção de otimização para "
"selecionar a busca. O Hibernate recupera um lote de instâncias ou entidades "
"usando um único <literal>SELECT, especificando uma lista de chaves "
"primárias ou chaves externas."

#. Tag: para
#: performance.xml:77
#, no-c-format
msgid "Hibernate also distinguishes between:"
msgstr "O Hibernate distingue também entre:"

#. Tag: para
#: performance.xml:81
#, no-c-format
msgid ""
"<emphasis>Immediate fetching: an association, collection or "
"attribute is fetched immediately when the owner is loaded."
msgstr ""
"<emphasis>Immediate fetching - uma associação, coleção ou função "
"é imediatamente recuperada, quando o proprietário for carregado. "

#. Tag: para
#: performance.xml:87
#, no-c-format
msgid ""
"<emphasis>Lazy collection fetching: a collection is fetched when "
"the application invokes an operation upon that collection. This is the "
"default for collections."
msgstr ""
"<emphasis>Lazy collection fetching - a coleção é recuperada "
"quando a aplicação invoca uma operação sobre aquela coleção. Esse é o padrão "
"para coleções."

#. Tag: para
#: performance.xml:93
#, no-c-format
msgid ""
"<emphasis>\"Extra-lazy\" collection fetching: individual elements "
"of the collection are accessed from the database as needed. Hibernate tries "
"not to fetch the whole collection into memory unless absolutely needed. It "
"is suitable for large collections."
msgstr ""
"<emphasis>\"Extra-lazy\" collection fetching - elementos "
"individuais de uma coleção são acessados a partir do banco de dados quando "
"necessário. O Hibernate tenta não buscar a coleção inteira dentro da memória "
"a menos que seja absolutamente necessário. Isto é indicado para coleções "
"muito grandes."

#. Tag: para
#: performance.xml:101
#, no-c-format
msgid ""
"<emphasis>Proxy fetching: a single-valued association is fetched "
"when a method other than the identifier getter is invoked upon the "
"associated object."
msgstr ""
"<emphasis>Proxy fetching: uma associação de um valor é carregada "
"quando um método diferente do getter do identificador é invocado sobre o "
"objeto associado."

#. Tag: para
#: performance.xml:107
#, no-c-format
msgid ""
"<emphasis>\"No-proxy\" fetching: a single-valued association is "
"fetched when the instance variable is accessed. Compared to proxy fetching, "
"this approach is less lazy; the association is fetched even when only the "
"identifier is accessed. It is also more transparent, since no proxy is "
"visible to the application. This approach requires buildtime bytecode "
"instrumentation and is rarely necessary."
msgstr ""
"<emphasis>\"No-proxy\" fetching - uma associação de um único "
"valor é recuperada quando a variável da instância é acessada. Comparada à "
"busca proxy, esse método é menos preguiçoso (lazy); a associação é buscada "
"até mesmo quando somente o identificador é acessado. Ela é mais "
"transparente, já que não há proxies visíveis para a aplicação. Esse método "
"requer instrumentação de bytecodes em build-time e é raramente necessário."

#. Tag: para
#: performance.xml:117
#, no-c-format
msgid ""
"<emphasis>Lazy attribute fetching: an attribute or single valued "
"association is fetched when the instance variable is accessed. This approach "
"requires buildtime bytecode instrumentation and is rarely necessary."
msgstr ""
"<emphasis>Lazy attribute fetching: um atributo ou associação de "
"um valor é buscado quanto a varíavel da instância é acessada. Esse método "
"requer instrumentação de bytecodes em build-time e é raramente necessário."

#. Tag: para
#: performance.xml:124
#, no-c-format
msgid ""
"We have two orthogonal notions here: <emphasis>when is the "
"association fetched and <emphasis>how is it fetched. It is "
"important that you do not confuse them. We use <literal>fetch to "
"tune performance. We can use <literal>lazy to define a contract "
"for what data is always available in any detached instance of a particular "
"class."
msgstr ""
"Nós temos aqui duas noções ortogonais: <emphasis>quando a "
"associação é buscada e <emphasis>como ela é buscada. É importante "
"que você não os confuda. Nós usamos <literal>fetch para ajustar o "
"desempenho. Podemos usar <literal>lazy para definir um contrato "
"para qual dado é sempre disponível em qualquer instância desconectada de uma "
"classe particular."

#. Tag: title
#: performance.xml:132
#, no-c-format
msgid "Working with lazy associations"
msgstr "Trabalhando com associações preguiçosas (lazy)"

#. Tag: para
#: performance.xml:134
#, no-c-format
msgid ""
"By default, Hibernate3 uses lazy select fetching for collections and lazy "
"proxy fetching for single-valued associations. These defaults make sense for "
"most associations in the majority of applications."
msgstr ""
"Por padrão, o Hibernate3 usa busca preguiçosa para coleções e busca "
"preguiçosa com proxy para associações de um valor. Esses padrões fazem "
"sentido para quase todas as associações em quase todas a aplicações. "

#. Tag: para
#: performance.xml:138
#, no-c-format
msgid ""
"If you set <literal>hibernate.default_batch_fetch_size, Hibernate "
"will use the batch fetch optimization for lazy fetching. This optimization "
"can also be enabled at a more granular level."
msgstr ""
"Se você ajustar <literal>hibernate. default_batch_fetch_size, o "
"Hibernate irá usar otimização de busca em lote para a busca preguiçosa. Essa "
"otimização pode ser também habilitada em um nível mais fino."

#. Tag: para
#: performance.xml:142
#, no-c-format
msgid ""
"Please be aware that access to a lazy association outside of the context of "
"an open Hibernate session will result in an exception. For example:"
msgstr ""
"Perceba que o acesso a associações preguiçosas fora do contexto de uma "
"sessão aberta do Hibernate irá resultar numa exceção. Por exemplo:"

#. Tag: programlisting
#: performance.xml:146
#, no-c-format
msgid ""
"s = sessions.openSession();\n"
"Transaction tx = s.beginTransaction();\n"
"            \n"
"User u = (User) s.createQuery(\"from User u where u.name=:userName\")\n"
"    .setString(\"userName\", userName).uniqueResult();\n"
"Map permissions = u.getPermissions();\n"
"\n"
"tx.commit();\n"
"s.close();\n"
"\n"
"Integer accessLevel = (Integer) permissions.get(\"accounts\");  // Error!"
msgstr ""

#. Tag: para
#: performance.xml:148
#, no-c-format
msgid ""
"Since the permissions collection was not initialized when the "
"<literal>Session was closed, the collection will not be able to "
"load its state. <emphasis>Hibernate does not support lazy initialization for "
"detached objects</emphasis>. This can be fixed by moving the code that reads "
"from the collection to just before the transaction is committed."
msgstr ""
"Como a coleção de permissões não foi inicializada quando a <literal>Session for the association mapping. "
"However, it is intended that lazy initialization be used for almost all "
"collections and associations. If you define too many non-lazy associations "
"in your object model, Hibernate will fetch the entire database into memory "
"in every transaction."
msgstr ""
"Alternativamente, nós podemos usar uma coleção ou associação não preguiçosa, "
"especificando <literal>lazy=\"false\" para o mapeamento da "
"associação. Porém, é pretendido que a inicialização preguiçosa seja usada "
"por quase todas as coleções e associações. Se você definir muitas "
"associações não preguiçosas em seu modelo de objetos, o Hibernate irá "
"precisar buscar no banco de dados inteiro da memória em cada transação."

#. Tag: para
#: performance.xml:162
#, no-c-format
msgid ""
"On the other hand, you can use join fetching, which is non-lazy by nature, "
"instead of select fetching in a particular transaction. We will now explain "
"how to customize the fetching strategy. In Hibernate3, the mechanisms for "
"choosing a fetch strategy are identical for single-valued associations and "
"collections."
msgstr ""
"Por outro lado, nós geralmente escolhemos a busca de união (que não é "
"preguiçosa por natureza) ao invés do selecionar busca em uma transação "
"particular. Nós agora veremos como customizar a estratégia de busca. No "
"Hibernate3, os mecanismos para escolher a estratégia de busca são idênticos "
"para as associações de valor único e para coleções."

#. Tag: title
#: performance.xml:170
#, no-c-format
msgid "Tuning fetch strategies"
msgstr "Personalizando as estratégias de busca"

#. Tag: para
#: performance.xml:172
#, no-c-format
msgid ""
"Select fetching (the default) is extremely vulnerable to N+1 selects "
"problems, so we might want to enable join fetching in the mapping document:"
msgstr ""
"O padrão selecionar busca, é extremamente vunerável aos problemas de seleção "
"N+1, então habilitaremos a busca de união no documento de mapeamento:"

#. Tag: programlisting
#: performance.xml:176
#, no-c-format
msgid ""
"<set name=\"permissions\"\n"
"            fetch=\"join\">\n"
"    <key column=\"userId\"/>\n"
"    <one-to-many class=\"Permission\"/>\n"
"</set"
msgstr ""

#. Tag: programlisting
#: performance.xml:178
#, no-c-format
msgid "<many-to-one name=\"mother\" class=\"Cat\" fetch=\"join\"/>"
msgstr ""

#. Tag: para
#: performance.xml:180
#, no-c-format
msgid ""
"The <literal>fetch strategy defined in the mapping document "
"affects:"
msgstr ""
"A estratégia de <literal>fetch definida no documento de mapeamento "
"afeta:"

#. Tag: para
#: performance.xml:185
#, no-c-format
msgid "retrieval via <literal>get() or load()"
msgstr "recupera via <literal>get() ou load()"

#. Tag: para
#: performance.xml:190
#, no-c-format
msgid "retrieval that happens implicitly when an association is navigated"
msgstr ""
"Recuperações que acontecem implicitamente quando navegamos por uma associação"

#. Tag: para
#: performance.xml:195
#, no-c-format
msgid "<literal>Criteria queries"
msgstr "consultas por <literal>Criteria "

#. Tag: para
#: performance.xml:199
#, no-c-format
msgid "HQL queries if <literal>subselect fetching is used"
msgstr "consultas HQL se a busca por <literal>subselect for usada"

#. Tag: para
#: performance.xml:204
#, no-c-format
msgid ""
"Irrespective of the fetching strategy you use, the defined non-lazy graph is "
"guaranteed to be loaded into memory. This might, however, result in several "
"immediate selects being used to execute a particular HQL query."
msgstr ""
"Independentemente da estratégia de busca que você usar, o gráfico não "
"preguiçoso definido será certamente carregado na memória. Note que isso irá "
"resultar em diversas seleções imediatas sendo usadas para rodar uma consulta "
"HQL em particular."

#. Tag: para
#: performance.xml:209
#, no-c-format
msgid ""
"Usually, the mapping document is not used to customize fetching. Instead, we "
"keep the default behavior, and override it for a particular transaction, "
"using <literal>left join fetch in HQL. This tells Hibernate to "
"fetch the association eagerly in the first select, using an outer join. In "
"the <literal>Criteria query API, you would use "
"<literal>setFetchMode(FetchMode.JOIN)."
msgstr ""
"Geralmente, não usamos documentos de mapeamento para customizar as buscas. "
"Ao invés disso, nós deixamos o comportamento padrão e sobrescrevemos isso em "
"uma transação em particular, usando <literal>left join fetch no "
"HQL. Isso diz ao Hibernate para buscar a associação inteira no primeiro "
"select, usando uma união externa. Na API de busca <literal>CriteriasetFetchMode(FetchMode.JOIN)."

#. Tag: para
#: performance.xml:216
#, no-c-format
msgid ""
"If you want to change the fetching strategy used by <literal>get() "
"or <literal>load(), you can use a Criteria "
"query. For example:"
msgstr ""
"Se você quiser mudar a estratégia de busca usada pelo <literal>get()load(), simplesmente use uma consulta por "
"<literal>Criteria, por exemplo: "

#. Tag: programlisting
#: performance.xml:220
#, no-c-format
msgid ""
"User user = (User) session.createCriteria(User.class)\n"
"                .setFetchMode(\"permissions\", FetchMode.JOIN)\n"
"                .add( Restrictions.idEq(userId) )\n"
"                .uniqueResult();"
msgstr ""

#. Tag: para
#: performance.xml:222
#, no-c-format
msgid ""
"This is Hibernate's equivalent of what some ORM solutions call a \"fetch plan"
"\"."
msgstr ""
"Isto é o equivalente do Hibernate para o que algumas soluções ORM chamam de "
"\"plano de busca\"."

#. Tag: para
#: performance.xml:225
#, no-c-format
msgid ""
"A completely different approach to problems with N+1 selects is to use the "
"second-level cache."
msgstr ""
"Um meio totalmente diferente de evitar problemas com selects N+1 é usar um "
"cache de segundo nível. "

#. Tag: title
#: performance.xml:230
#, no-c-format
msgid "Single-ended association proxies"
msgstr "Proxies de associação final único"

#. Tag: para
#: performance.xml:232
#, no-c-format
msgid ""
"Lazy fetching for collections is implemented using Hibernate's own "
"implementation of persistent collections. However, a different mechanism is "
"needed for lazy behavior in single-ended associations. The target entity of "
"the association must be proxied. Hibernate implements lazy initializing "
"proxies for persistent objects using runtime bytecode enhancement which is "
"accessed via the CGLIB library."
msgstr ""
"A recuperação preguiçosa para coleções é implementada usando uma "
"implementação própria do Hibernate para coleções persistentes. Porém, é "
"necessário um mecanismo diferente para comportamento preguiçoso em "
"associações de final único. A entidade alvo da associação precisa usar um "
"proxy. O Hibernate implementa proxies para inicialização preguiçosa em "
"objetos persistentes usando manipulação de bytecode, através da excelente "
"biblioteca CGLIB. "

#. Tag: para
#: performance.xml:239
#, no-c-format
msgid ""
"At startup, Hibernate3 generates proxies by default for all persistent "
"classes and uses them to enable lazy fetching of <literal>many-to-oneone-to-one associations."
msgstr ""
"Por padrão, o Hibernate3 gera proxies (na inicialização) para todas as "
"classes persistentes que os usem para habilitar recuperação preguiçosa de "
"associações <literal>many-to-one e one-to-one. "

#. Tag: para
#: performance.xml:244
#, no-c-format
msgid ""
"The mapping file may declare an interface to use as the proxy interface for "
"that class, with the <literal>proxy attribute. By default, "
"Hibernate uses a subclass of the class. <emphasis>The proxied class must "
"implement a default constructor with at least package visibility. This "
"constructor is recommended for all persistent classes</emphasis>."
msgstr ""
"O arquivo de mapeamento deve declarar uma interface para usar como interface "
"de proxy para aquela classe, com a função <literal>proxy. Por "
"padrão, o Hibernate usa uma subclasse dessa classe. <emphasis>Note que a "
"classe a ser usada via proxy precisa implementar o construtor padrão com "
"pelo menos visibilidade de package. Nós recomendamos esse construtor para "
"todas as classes persistentes</emphasis>."

#. Tag: para
#: performance.xml:251
#, no-c-format
msgid ""
"There are potential problems to note when extending this approach to "
"polymorphic classes.For example:"
msgstr ""
"Existe alguns truques que você deve saber quando estender esse comportamento "
"para classes polimórficas. Por exemplo:"

#. Tag: programlisting
#: performance.xml:254
#, no-c-format
msgid ""
"<class name=\"Cat\" proxy=\"Cat\">\n"
"    ......\n"
"    <subclass name=\"DomesticCat\">\n"
"        .....\n"
"    </subclass>\n"
"</class>"
msgstr ""

#. Tag: para
#: performance.xml:256
#, no-c-format
msgid ""
"Firstly, instances of <literal>Cat will never be castable to "
"<literal>DomesticCat, even if the underlying instance is an "
"instance of <literal>DomesticCat:"
msgstr ""
"Primeiramente, instâncias de <literal>Cat nunca serão convertidas "
"para <literal>DomesticCat, mesmo que a instância em questão seja "
"uma instância de <literal>DomesticCat:"

#. Tag: programlisting
#: performance.xml:260
#, no-c-format
msgid ""
"Cat cat = (Cat) session.load(Cat.class, id);  // instantiate a proxy (does "
"not hit the db)\n"
"if ( cat.isDomesticCat() ) {                  // hit the db to initialize "
"the proxy\n"
"    DomesticCat dc = (DomesticCat) cat;       // Error!\n"
"    ....\n"
"}"
msgstr ""

#. Tag: para
#: performance.xml:262
#, no-c-format
msgid "Secondly, it is possible to break proxy <literal>==:"
msgstr "E, segundo, é possível quebrar o proxy <literal>==:"

#. Tag: programlisting
#: performance.xml:265
#, no-c-format
msgid ""
"Cat cat = (Cat) session.load(Cat.class, id);            // instantiate a Cat "
"proxy\n"
"DomesticCat dc = \n"
"        (DomesticCat) session.load(DomesticCat.class, id);  // acquire new "
"DomesticCat proxy!\n"
"System.out.println(cat==dc);                            // false"
msgstr ""

#. Tag: para
#: performance.xml:267
#, no-c-format
msgid ""
"However, the situation is not quite as bad as it looks. Even though we now "
"have two references to different proxy objects, the underlying instance will "
"still be the same object:"
msgstr ""
"Porém a situação não é tão ruim como parece. Mesmo quando temos duas "
"referências para objetos proxies diferentes, a instância adjacente será do "
"mesmo objeto:"

#. Tag: programlisting
#: performance.xml:271
#, no-c-format
msgid ""
"cat.setWeight(11.0);  // hit the db to initialize the proxy\n"
"System.out.println( dc.getWeight() );  // 11.0"
msgstr ""

#. Tag: para
#: performance.xml:273
#, no-c-format
msgid ""
"Third, you cannot use a CGLIB proxy for a <literal>final class or "
"a class with any <literal>final methods."
msgstr ""
"E por terceiro, você não pode usar um proxy CGLIB em uma classe "
"<literal>final ou com quaisquer métodos final."

#. Tag: para
#: performance.xml:276
#, no-c-format
msgid ""
"Finally, if your persistent object acquires any resources upon instantiation "
"(e.g. in initializers or default constructor), then those resources will "
"also be acquired by the proxy. The proxy class is an actual subclass of the "
"persistent class."
msgstr ""
"Finalmente, se o seu objeto persistente adquirir qualquer recurso durante a "
"instanciação (ex. em inicializadores ou construtor padrão), então esses "
"recursos serão adquiridos pelo proxy também. A classe de proxy é uma "
"subclasse da classe persistente. "

#. Tag: para
#: performance.xml:281
#, no-c-format
msgid ""
"These problems are all due to fundamental limitations in Java's single "
"inheritance model. To avoid these problems your persistent classes must each "
"implement an interface that declares its business methods. You should "
"specify these interfaces in the mapping file where <literal>CatImplCat and "
"<literal>DomesticCatImpl implements the interface "
"<literal>DomesticCat. For example:"
msgstr ""
"Esses problemas se dão devido à limitação originária do modelo de herança "
"simples do Java. Se você quiser evitar esses problemas em suas classes "
"persistentes você deve implementar uma interface que declare seus métodos "
"comerciais. Você deve especificar essas interfaces no arquivo de mapeamento "
"onde <literal>CatImpl implementa a interface CatDomesticCatImpl implementa a interface "
"<literal>DomesticCat. Por exemplo: "

#. Tag: programlisting
#: performance.xml:289
#, no-c-format
msgid ""
"<class name=\"CatImpl\" proxy=\"Cat\">\n"
"    ......\n"
"    <subclass name=\"DomesticCatImpl\" proxy=\"DomesticCat\">\n"
"        .....\n"
"    </subclass>\n"
"</class>"
msgstr ""

#. Tag: para
#: performance.xml:291
#, no-c-format
msgid ""
"Then proxies for instances of <literal>Cat and "
"<literal>DomesticCat can be returned by load() "
"or <literal>iterate()."
msgstr ""
"Então, os proxies para instâncias de <literal>Cat e  "
"<literal>DomesticCat podem ser retornadas pelo load()iterate()."

#. Tag: programlisting
#: performance.xml:295
#, no-c-format
msgid ""
"Cat cat = (Cat) session.load(CatImpl.class, catid);\n"
"Iterator iter = session.createQuery(\"from CatImpl as cat where cat."
"name='fritz'\").iterate();\n"
"Cat fritz = (Cat) iter.next();"
msgstr ""

#. Tag: title
#: performance.xml:298
#, no-c-format
msgid "Note"
msgstr "Nota"

#. Tag: para
#: performance.xml:300
#, no-c-format
msgid "<literal>list() does not usually return proxies."
msgstr "<literal>list() normalmente retorna proxies."

#. Tag: para
#: performance.xml:304
#, no-c-format
msgid ""
"Relationships are also lazily initialized. This means you must declare any "
"properties to be of type <literal>Cat, not CatImpl, e não CatImpl."

#. Tag: para
#: performance.xml:308
#, no-c-format
msgid ""
"Certain operations do <emphasis>not require proxy initialization:"
msgstr ""
"Algumas operações <emphasis>não requerem inicialização por proxy: "

#. Tag: para
#: performance.xml:313
#, no-c-format
msgid ""
"<literal>equals(): if the persistent class does not override "
"<literal>equals()"
msgstr ""
"<literal>equals(): se a classe persistente não sobrescrever "
"<literal>equals()"

#. Tag: para
#: performance.xml:318
#, no-c-format
msgid ""
"<literal>hashCode(): if the persistent class does not override "
"<literal>hashCode()"
msgstr ""
"<literal>hashCode(): se a classe persistente não sobrescrever "
"<literal>hashCode()"

#. Tag: para
#: performance.xml:323
#, no-c-format
msgid "The identifier getter method"
msgstr "O método getter do identificador"

#. Tag: para
#: performance.xml:327
#, no-c-format
msgid ""
"Hibernate will detect persistent classes that override <literal>equals()hashCode()."
msgstr ""
"O Hibernate irá detectar classes persistentes que sobrescrevem "
"<literal>equals() ou hashCode()."

#. Tag: para
#: performance.xml:330
#, no-c-format
msgid ""
"By choosing <literal>lazy=\"no-proxy\" instead of the default "
"<literal>lazy=\"proxy\", you can avoid problems associated with "
"typecasting. However, buildtime bytecode instrumentation is required, and "
"all operations will result in immediate proxy initialization."
msgstr ""
"Escolhendo <literal>lazy=\"no-proxy\" ao invés do padrão "
"<literal>lazy=\"proxy\", podemos evitar problemas associados com "
"typecasting. Porém, iremos precisar de instrumentação de bytecode em tempo "
"de compilação e todas as operações irão resultar em inicializações de proxy "
"imediatas. "

#. Tag: title
#: performance.xml:338
#, no-c-format
msgid "Initializing collections and proxies"
msgstr "Inicializando coleções e proxies"

#. Tag: para
#: performance.xml:340
#, no-c-format
msgid ""
"A <literal>LazyInitializationException will be thrown by Hibernate "
"if an uninitialized collection or proxy is accessed outside of the scope of "
"the <literal>Session, i.e., when the entity owning the collection "
"or having the reference to the proxy is in the detached state."
msgstr ""
"Será lançada uma <literal>LazyInitializationException se uma "
"coleção não inicializada ou proxy for acessado fora do escopo da "
"<literal>Session, isto é, quando a entidade que contém a coleção "
"ou que possua a referência ao proxy estiver no estado desanexado. "

#. Tag: para
#: performance.xml:346
#, no-c-format
msgid ""
"Sometimes a proxy or collection needs to be initialized before closing the "
"<literal>Session. You can force initialization by calling "
"<literal>cat.getSex() or cat.getKittens().size(). Claro que sempre podemos "
"forçar a inicialização chamando <literal>cat.getSex() ou "
"<literal>cat.getKittens().size(), por exemplo. Mas isto parece "
"confuso para quem lê o código e não é conveniente para códigos genéricos. "

#. Tag: para
#: performance.xml:353
#, no-c-format
msgid ""
"The static methods <literal>Hibernate.initialize() and "
"<literal>Hibernate.isInitialized(), provide the application with a "
"convenient way of working with lazily initialized collections or proxies. "
"<literal>Hibernate.initialize(cat) will force the initialization "
"of a proxy, <literal>cat, as long as its SessionHibernate.initialize( cat.getKittens() ) e "
"<literal>Hibernate.isInitialized() favorecem a aplicação para "
"trabalhar com coleções ou proxies inicializados de forma preguiçosa. O "
"<literal>Hibernate.initialize(cat) irá forçar a inicialização de "
"um proxy, <literal>cat, contanto que a Session "
"esteja ainda aberta. <literal>Hibernate.initialize (cat.getKittens() ) open until all "
"required collections and proxies have been loaded. In some application "
"architectures, particularly where the code that accesses data using "
"Hibernate, and the code that uses it are in different application layers or "
"different physical processes, it can be a problem to ensure that the "
"<literal>Session is open when a collection is initialized. There "
"are two basic ways to deal with this issue:"
msgstr ""
"Uma outra opção é manter a <literal>Session aberta até que todas "
"as coleções e os proxies necessários sejam carregados. Em algumas "
"arquiteturas de aplicações, particularmente onde o código que acessa os "
"dados usando Hibernate e o código que os usa, se encontram em diferentes "
"camadas da aplicação ou diferentes processos físicos, será um problema "
"garantir que a <literal>Session esteja aberta quando uma coleção "
"for inicializada. Existem dois caminhos básicos para lidar com esse "
"problema: "

#. Tag: para
#: performance.xml:372
#, no-c-format
msgid ""
"In a web-based application, a servlet filter can be used to close the "
"<literal>Session only at the end of a user request, once the "
"rendering of the view is complete (the <emphasis>Open Session in View is closed and the transaction "
"ended before returning to the user, even when an exception occurs during "
"rendering of the view. See the Hibernate Wiki for examples of this \"Open "
"Session in View\" pattern."
msgstr ""
"Em uma aplicações web, um filtro servlet pode ser usado para fechar a "
"<literal>Session somente no final da requisição do usuário, quando "
"a renderização da view estiver completa (o modelo <emphasis>Abrir Sessão em "
"View</emphasis>). Claro, que isto demanda uma exatidão no manuseio de "
"exceções na infraestrutura de sua aplicação. É extremamente importante que a "
"<literal>Session seja fechada e a transação terminada antes de "
"retornar para o usuário, mesmo que uma exceção ocorra durante a renderização "
"da view. Veja o Wiki do Hibernate para exemplos do pattern \"Abrir Sessão em "
"View\"."

#. Tag: para
#: performance.xml:385
#, no-c-format
msgid ""
"In an application with a separate business tier, the business logic must "
"\"prepare\" all collections that the web tier needs before returning. This "
"means that the business tier should load all the data and return all the "
"data already initialized to the presentation/web tier that is required for a "
"particular use case. Usually, the application calls <literal>Hibernate."
"initialize()</literal> for each collection that will be needed in the web "
"tier (this call must occur before the session is closed) or retrieves the "
"collection eagerly using a Hibernate query with a <literal>FETCH "
"clause or a <literal>FetchMode.JOIN in CriteriaCommandSession Facade."
msgstr ""
"Em uma aplicação com uma camada de negócios separada, a lógica de negócios "
"deve \"preparar\" todas as coleções que serão usadas pela camada web antes "
"de retornar. Isto sgnifica que a camada de negócios deve carregar todos os "
"dados e retorná-los já inicializados para a camada de apresentação que é "
"representada para um caso de uso particular. Geralmente, a aplicação chama "
"<literal>Hibernate.initialize() para cada coleção que será usada "
"pela camada web (essa chamada deve ocorrer antes da sessão ser fechada) ou "
"retorna a coleção usando uma consulta Hibernate com uma cláusula "
"<literal>FETCH ou um FetchMode.JOIN na "
"<literal>Criteria. Fica muito mais fácil se você adotar o modelo "
"<emphasis>Command ao invés do Session Facademerge() or lock() before "
"accessing uninitialized collections or other proxies. Hibernate does not, "
"and certainly <emphasis>should not, do this automatically since "
"it would introduce impromptu transaction semantics."
msgstr ""
"Você também pode anexar um objeto previamente carregado em uma nova "
"<literal>Sessionmerge() ou lock() fazer isso "
"automaticamente, pois isso introduziria semântica em transações  impromptu."

#. Tag: para
#: performance.xml:410
#, no-c-format
msgid ""
"Sometimes you do not want to initialize a large collection, but still need "
"some information about it, like its size, for example, or a subset of the "
"data."
msgstr ""
"Às vezes você não quer inicializar uma coleção muito grande, mas precisa de "
"algumas informações, como o mesmo tamanho, ou um subconjunto de seus dados."

#. Tag: para
#: performance.xml:414
#, no-c-format
msgid ""
"You can use a collection filter to get the size of a collection without "
"initializing it:"
msgstr ""
"Você pode usar um filtro de coleção para saber seu tamanho sem inicializá-la:"

#. Tag: programlisting
#: performance.xml:417
#, no-c-format
msgid ""
"( (Integer) s.createFilter( collection, \"select count(*)\" ).list().get"
"(0) ).intValue()"
msgstr ""

#. Tag: para
#: performance.xml:419
#, no-c-format
msgid ""
"The <literal>createFilter() method is also used to efficiently "
"retrieve subsets of a collection without needing to initialize the whole "
"collection:"
msgstr ""
"O método <literal>createFilter() é usado também para retornar "
"algus dados de uma coleção eficientemente sem precisar inicializar a coleção "
"inteira:"

#. Tag: programlisting
#: performance.xml:423
#, no-c-format
msgid ""
"s.createFilter( lazyCollection, \"\").setFirstResult(0).setMaxResults(10)."
"list();"
msgstr ""

#. Tag: title
#: performance.xml:427
#, no-c-format
msgid "Using batch fetching"
msgstr "Usando busca em lote"

#. Tag: para
#: performance.xml:429
#, no-c-format
msgid ""
"Using batch fetching, Hibernate can load several uninitialized proxies if "
"one proxy is accessed. Batch fetching is an optimization of the lazy select "
"fetching strategy. There are two ways you can configure batch fetching: on "
"the class level and the collection level."
msgstr ""
"O Hibernate pode fazer uso eficiente de busca em lote, ou seja o Hibernate "
"pode carregar diversos proxies não inicializados, se um proxy for acessado "
"(ou coleções). A busca em lote é uma otimização da estratégia da busca de "
"seleção lazy. Existem duas maneiras para você usar a busca em lote: no nível "
"da classe ou no nível da coleção."

#. Tag: para
#: performance.xml:434
#, no-c-format
msgid ""
"Batch fetching for classes/entities is easier to understand. Consider the "
"following example: at runtime you have 25 <literal>Cat instances "
"loaded in a <literal>Session, and each Cat has "
"a reference to its <literal>owner, a Person. "
"The <literal>Person class is mapped with a proxy, lazy="
"\"true\"</literal>. If you now iterate through all cats and call "
"<literal>getOwner() on each, Hibernate will, by default, execute "
"25 <literal>SELECT statements to retrieve the proxied owners. You "
"can tune this behavior by specifying a <literal>batch-size in the "
"mapping of <literal>Person:"
msgstr ""
"A recuperação em lote para classes/entidades é mais fácil de entender. "
"Imagine que você tem a seguinte situação em tempo de execução: você tem 25 "
"instâncias de <literal>Cat carregadas em uma SessionCat possui uma referência ao seu "
"<literal>owner, que é da classe Person. A "
"classe <literal>Person é mapeada com um proxy, lazy=\"true"
"\"</literal>. Se você interar sobre todos os Cat's e chamar getOwner"
"()</literal> em cada, o Hibernate irá por padrão executar 25 comandos "
"<literal>SELECT(), para buscar os proxies de owners. Você pode "
"melhorar esse comportamento especificando um <literal>batch-size "
"no mapeamento da classe <literal>Person: "

#. Tag: programlisting
#: performance.xml:447
#, no-c-format
msgid "<class name=\"Person\" batch-size=\"10\">...</class>"
msgstr ""

#. Tag: para
#: performance.xml:449
#, no-c-format
msgid ""
"Hibernate will now execute only three queries: the pattern is 10, 10, 5."
msgstr ""
"O Hibernate irá executar agora apenas três consultas; o padrão é 10, 10, 5."

#. Tag: para
#: performance.xml:452
#, no-c-format
msgid ""
"You can also enable batch fetching of collections. For example, if each "
"<literal>Person has a lazy collection of Cats, "
"and 10 persons are currently loaded in the <literal>Session, "
"iterating through all persons will generate 10 <literal>SELECTs, "
"one for every call to <literal>getCats(). If you enable batch "
"fetching for the <literal>cats collection in the mapping of "
"<literal>Person, Hibernate can pre-fetch collections:"
msgstr ""
"Você também pode habilitar busca em lote de uma coleção. Por exemplo, se "
"cada <literal>Person tem uma coleção preguiçosa de CatSessionSELECTs ao se interar todas as "
"persons, um para cada chamada de <literal>getCats(). Se você "
"habilitar busca em lote para a coleção de <literal>cats no "
"mapeamento da classe <literal>Person, o Hibernate pode fazer uma "
"pré carga das coleções:"

#. Tag: programlisting
#: performance.xml:461
#, no-c-format
msgid ""
"<class name=\"Person\">\n"
"    <set name=\"cats\" batch-size=\"3\">\n"
"        ...\n"
"    </set>\n"
"</class>"
msgstr ""

#. Tag: para
#: performance.xml:463
#, no-c-format
msgid ""
"With a <literal>batch-size of 3, Hibernate will load 3, 3, 3, 1 "
"collections in four <literal>SELECTs. Again, the value of the "
"attribute depends on the expected number of uninitialized collections in a "
"particular <literal>Session."
msgstr ""
"Com um <literal>batch-size de 3, o Hibernate irá carregar 3, 3, 3, "
"1 coleções em 4 <literal>SELECTs. Novamente, o valor da função "
"depende do número esperado de coleções não inicializadas em determinada "
"<literal>Session."

#. Tag: para
#: performance.xml:468
#, no-c-format
msgid ""
"Batch fetching of collections is particularly useful if you have a nested "
"tree of items, i.e. the typical bill-of-materials pattern. However, a "
"<emphasis>nested set or a materialized path "
"might be a better option for read-mostly trees."
msgstr ""
"A busca em lote de coleções é particularmente útil quando você tem uma "
"árvore encadeada de ítens, ex.: o típico padrão bill-of-materials (Se bem "
"que um <emphasis>conjunto encadeado ou caminho "
"materializado</emphasis> pode ser uma opção melhor para árvores com mais "
"leitura."

#. Tag: title
#: performance.xml:475
#, no-c-format
msgid "Using subselect fetching"
msgstr "Usando busca de subseleção"

#. Tag: para
#: performance.xml:477
#, no-c-format
msgid ""
"If one lazy collection or single-valued proxy has to be fetched, Hibernate "
"will load all of them, re-running the original query in a subselect. This "
"works in the same way as batch-fetching but without the piecemeal loading."
msgstr ""
"Se uma coleção ou proxy simples precisa ser recuperado, o Hibernate carrega "
"todos eles rodando novamente a consulta original em uma subseleção. Isso "
"funciona da mesma maneira que busca em lote, sem carregar tanto."

#. Tag: title
#: performance.xml:486
#, no-c-format
msgid "Fetch profiles"
msgstr "Perfis de Busca "

#. Tag: para
#: performance.xml:488
#, fuzzy, no-c-format
msgid ""
"Another way to affect the fetching strategy for loading associated objects "
"is through something called a fetch profile, which is a named configuration "
"associated with the <interfacename>org.hibernate.SessionFactoryorg.hibernate."
"Session</interfacename>. Once enabled on a org.hibernate."
"Session</interfacename>, the fetch profile will be in affect for that "
"<interfacename>org.hibernate.Session until it is explicitly "
"disabled."
msgstr ""
"Outra forma de afetar a estratégia de busca para o carregamento de objetos "
"associados é através do chamado perfil de busca, que é uma associação de "
"configuração de nomeada com o <interfacename>org.hibernate.SessionFactoryorg.hibernate."
"Session</interfacename>. Uma vez ativado no org.hibernate."
"Session</interfacename>, o perfil de busca será afetado pelo "
"<interfacename>org.hibernate.Session até que o mesmo seja "
"completamente desativado."

#. Tag: para
#: performance.xml:498
#, fuzzy, no-c-format
msgid ""
"So what does that mean? Well lets explain that by way of an example which "
"show the different available approaches to configure a fetch profile:"
msgstr ""
"O que isto significa? A explicação será através de um exemplo. Vamos dizer "
"que nós temos os seguintes mapeamentos:"

#. Tag: title
#: performance.xml:503
#, no-c-format
msgid "Specifying a fetch profile using <classname>@FetchProfile"
msgstr ""

#. Tag: programlisting
#: performance.xml:506
#, no-c-format
msgid ""
"@Entity\n"
"@FetchProfile(name = \"customer-with-orders\", fetchOverrides = {\n"
"   @FetchProfile.FetchOverride(entity = Customer.class, association = "
"\"orders\", mode = FetchMode.JOIN)\n"
"})\n"
"public class Customer {\n"
"   @Id\n"
"   @GeneratedValue\n"
"   private long id;\n"
"\n"
"   private String name;\n"
"\n"
"   private long customerNumber;\n"
"\n"
"   @OneToMany\n"
"   private Set<Order> orders;\n"
"\n"
"   // standard getter/setter\n"
"   ...\n"
"}"
msgstr ""

#. Tag: title
#: performance.xml:510
#, no-c-format
msgid ""
"Specifying a fetch profile using <literal><fetch-profile> "
"outside <literal><class> node"
msgstr ""

#. Tag: programlisting
#: performance.xml:514
#, no-c-format
msgid ""
"<hibernate-mapping>\n"
"    <class name=\"Customer\">\n"
"        ...\n"
"        <set name=\"orders\" inverse=\"true\">\n"
"            <key column=\"cust_id\"/>\n"
"            <one-to-many class=\"Order\"/>\n"
"        </set>\n"
"    </class>\n"
"    <class name=\"Order\">\n"
"        ...\n"
"    </class>\n"
"    <fetch-profile name=\"customer-with-orders\">\n"
"        <fetch entity=\"Customer\" association=\"orders\" style=\"join\"/"
">\n"
"    </fetch-profile>\n"
"</hibernate-mapping>"
msgstr ""

#. Tag: title
#: performance.xml:518
#, no-c-format
msgid ""
"Specifying a fetch profile using <literal><fetch-profile> "
"inside <literal><class> node"
msgstr ""

#. Tag: programlisting
#: performance.xml:522
#, no-c-format
msgid ""
"<hibernate-mapping>\n"
"    <class name=\"Customer\">\n"
"        ...\n"
"        <set name=\"orders\" inverse=\"true\">\n"
"            <key column=\"cust_id\"/>\n"
"            <one-to-many class=\"Order\"/>\n"
"        </set>\n"
"        <fetch-profile name=\"customer-with-orders\">\n"
"            <fetch association=\"orders\" style=\"join\"/>\n"
"        </fetch-profile>\n"
"    </class>\n"
"    <class name=\"Order\">\n"
"        ...\n"
"    </class>\n"
"</hibernate-mapping>"
msgstr ""

#. Tag: para
#: performance.xml:525
#, fuzzy, no-c-format
msgid ""
"Now normally when you get a reference to a particular customer, that "
"customer's set of orders will be lazy meaning we will not yet have loaded "
"those orders from the database. Normally this is a good thing. Now lets say "
"that you have a certain use case where it is more efficient to load the "
"customer and their orders together. One way certainly is to use \"dynamic "
"fetching\" strategies via an HQL or criteria queries. But another option is "
"to use a fetch profile to achieve that. The following code will load both "
"the customer <emphasis>andtheir orders:"
msgstr ""
"Normalmente, quando você recebe uma referência para um cliente em "
"particular, o conjunto do cliente de pedidos será lento, significando que "
"nós ainda não baixamos estes pedidos a partir do banco de dados. Na maioria "
"das vezes isto é bom. Agora vamos imaginar que você possui um determinado "
"caso de uso, onde é mais eficiente carregar o cliente e outros pedidos "
"juntos. Uma maneira correta é utilizar as estratégias de \"busca dinâmica\" "
"através de um HQL ou consultas de critério. Entretanto, outra opção é usar "
"um perfil de busca para atingir o mesmo objeto. Apenas adicione o seguinte a "
"seu mapeamento:"

#. Tag: title
#: performance.xml:536
#, no-c-format
msgid "Activating a fetch profile for a given <classname>Session"
msgstr ""

#. Tag: programlisting
#: performance.xml:539
#, no-c-format
msgid ""
"Session session = ...;\n"
"session.enableFetchProfile( \"customer-with-orders\" );  // name matches "
"from mapping\n"
"Customer customer = (Customer) session.get( Customer.class, customerId );"
msgstr ""

#. Tag: para
#: performance.xml:543
#, no-c-format
msgid ""
"<classname>@FetchProfile definitions are global and it does not "
"matter on which class you place them. You can place the "
"<classname>@FetchProfile annotation either onto a class or "
"package (package-info.java). In order to define multiple fetch profiles for "
"the same class or package <classname>@FetchProfiles can be used."
msgstr ""

#. Tag: para
#: performance.xml:551
#, no-c-format
msgid ""
"Currently only join style fetch profiles are supported, but they plan is to "
"support additional styles. See <ulink url=\"http://opensource.atlassian.com/"
"projects/hibernate/browse/HHH-3414\">HHH-3414</ulink> for details."
msgstr ""
"Apenas os perfis de busca em estilo são suportados, mas planeja-se o suporte "
"de estilos adicionais. Consulte <ulink url=\"http://opensource.atlassian.com/"
"projects/hibernate/browse/HHH-3414\">HHH-3414</ulink> para maiores detalhes."

#. Tag: title
#: performance.xml:558
#, no-c-format
msgid "Using lazy property fetching"
msgstr "Usando busca preguiçosa de propriedade"

#. Tag: para
#: performance.xml:560
#, no-c-format
msgid ""
"Hibernate3 supports the lazy fetching of individual properties. This "
"optimization technique is also known as <emphasis>fetch groups. "
"Please note that this is mostly a marketing feature; optimizing row reads is "
"much more important than optimization of column reads. However, only loading "
"some properties of a class could be useful in extreme cases. For example, "
"when legacy tables have hundreds of columns and the data model cannot be "
"improved."
msgstr ""
"O Hibernate3 suporta a busca lazy de propriedades individuais. Essa técnica "
"de otimização é também conhecida como <emphasis>grupos de busca. "
"Veja que esta é mais uma característica de marketing já que na prática, é "
"mais importante a otimização nas leituras dos registros do que na leitura "
"das colunas. Porém, carregar apenas algumas propriedades de uma classe pode "
"ser útil em casos extremos, onde tabelas legadas podem ter centenas de "
"colunas e o modelo de dados não pode ser melhorado."

#. Tag: para
#: performance.xml:568
#, no-c-format
msgid ""
"To enable lazy property loading, set the <literal>lazy attribute "
"on your particular property mappings:"
msgstr ""
"Para habilitar a carga de propriedade lazy, é preciso ajustar a função "
"<literal>lazy no seu mapeamento de propriedade:"

#. Tag: programlisting
#: performance.xml:571
#, no-c-format
msgid ""
"<class name=\"Document\">\n"
"       <id name=\"id\">\n"
"        <generator class=\"native\"/>\n"
"    </id>\n"
"    <property name=\"name\" not-null=\"true\" length=\"50\"/>\n"
"    <property name=\"summary\" not-null=\"true\" length=\"200\" lazy="
"\"true\"/>\n"
"    <property name=\"text\" not-null=\"true\" length=\"2000\" lazy=\"true"
"\"/>\n"
"</class>"
msgstr ""

#. Tag: para
#: performance.xml:573
#, no-c-format
msgid ""
"Lazy property loading requires buildtime bytecode instrumentation. If your "
"persistent classes are not enhanced, Hibernate will ignore lazy property "
"settings and return to immediate fetching."
msgstr ""
"A carga de propriedades lazy requer instrumentação de bytecode. Se suas "
"classes persistentes não forem melhoradas, o Hibernate irá ignorar "
"silenciosamente essa configuração e usará a busca imediata."

#. Tag: para
#: performance.xml:577
#, no-c-format
msgid "For bytecode instrumentation, use the following Ant task:"
msgstr "Para instrumentação de bytecode, use a seguinte tarefa do Ant:"

#. Tag: programlisting
#: performance.xml:579
#, no-c-format
msgid ""
"<target name=\"instrument\" depends=\"compile\">\n"
"    <taskdef name=\"instrument\" classname=\"org.hibernate.tool."
"instrument.InstrumentTask\">\n"
"        <classpath path=\"${jar.path}\"/>\n"
"        <classpath path=\"${classes.dir}\"/>\n"
"        <classpath refid=\"lib.class.path\"/>\n"
"    </taskdef>\n"
"\n"
"    <instrument verbose=\"true\">\n"
"        <fileset dir=\"${testclasses.dir}/org/hibernate/auction/model"
"\">\n"
"            <include name=\"*.class\"/>\n"
"        </fileset>\n"
"    </instrument>\n"
"</target>"
msgstr ""

#. Tag: para
#: performance.xml:581
#, no-c-format
msgid ""
"A different way of avoiding unnecessary column reads, at least for read-only "
"transactions, is to use the projection features of HQL or Criteria queries. "
"This avoids the need for buildtime bytecode processing and is certainly a "
"preferred solution."
msgstr ""
"Uma forma diferente de evitar leitura de coluna desnecessária, ao menos para "
"transações de somente leitura, deve-se usar os recursos de projeção do HQL "
"ou consultas por Critério. Isto evita a necessidade de processamento de "
"bytecode em build-time e é certamente uma melhor solução."

#. Tag: para
#: performance.xml:586
#, no-c-format
msgid ""
"You can force the usual eager fetching of properties using <literal>fetch "
"all properties</literal> in HQL."
msgstr ""
"Você pode forçar a busca antecipada comum de propriedades usando "
"<literal>buscar todas as propriedades no HQL."

#. Tag: title
#: performance.xml:592
#, no-c-format
msgid "The Second Level Cache"
msgstr "O Cachê de Segundo Nível"

#. Tag: para
#: performance.xml:594
#, no-c-format
msgid ""
"A Hibernate <literal>Session is a transaction-level cache of "
"persistent data. It is possible to configure a cluster or JVM-level "
"(<literal>SessionFactory-level) cache on a class-by-class and "
"collection-by-collection basis. You can even plug in a clustered cache. Be "
"aware that caches are not aware of changes made to the persistent store by "
"another application. They can, however, be configured to regularly expire "
"cached data."
msgstr ""
"Uma <literal>Session do Hibernate é um cache de nível transacional "
"de dados persistentes. É possível configurar um cluster ou um cache de nível "
"JVM (nível <literal>SessionFactory) em uma estrutura classe por "
"classe e coleção por coleção. Você pode até mesmo plugar em um cache em "
"cluster. Tenha cuidado, pois os caches nunca sabem das mudanças feitas em "
"armazenamento persistente por um outro aplicativo. No entanto, eles podem "
"ser configurados para dados em cache vencido regularmente."

#. Tag: para
#: performance.xml:602
#, fuzzy, no-c-format
msgid ""
"You have the option to tell Hibernate which caching implementation to use by "
"specifying the name of a class that implements <literal>org.hibernate.cache."
"CacheProvider</literal> using the property hibernate.cache."
"provider_class</literal>. Hibernate is bundled with a number of built-in "
"integrations with the open-source cache providers that are listed in <xref "
"linkend=\"cacheproviders\"/>. You can also implement your own and plug it in "
"as outlined above. Note that versions prior to Hibernate 3.2 use EhCache as "
"the default cache provider."
msgstr ""
"Você tem a opção de informar o Hibernate sobre qual implementação de cache "
"utilizar, especificando o nome de uma classe que implementa <literal>org."
"hibernate.cache.CacheProvider</literal> usando a propriedade "
"<literal>hibernate.cache.provider_class. O Hibernate vem envolvido "
"com um número de integrações construídas com provedores de cache de fonte "
"aberta (listados abaixo). Além disso, você pode implementar seu próprio e "
"plugá-lo como mencionado acima. Note que as versões anteriores ao padrão 3.2 "
"utilizam EhCache como provedor de cache padrão. "

#. Tag: title
#: performance.xml:613
#, no-c-format
msgid "Cache Providers"
msgstr "Provedores de Cache "

#. Tag: entry
#: performance.xml:628 performance.xml:976
#, no-c-format
msgid "Cache"
msgstr "Cache"

#. Tag: entry
#: performance.xml:630
#, no-c-format
msgid "Provider class"
msgstr "Classe de provedor"

#. Tag: entry
#: performance.xml:632
#, no-c-format
msgid "Type"
msgstr "Tipo"

#. Tag: entry
#: performance.xml:634
#, no-c-format
msgid "Cluster Safe"
msgstr "Segurança de Cluster"

#. Tag: entry
#: performance.xml:636
#, no-c-format
msgid "Query Cache Supported"
msgstr "Cache de Consulta Suportado"

#. Tag: entry
#: performance.xml:642 performance.xml:990
#, no-c-format
msgid "Hashtable (not intended for production use)"
msgstr "Hashtable (não recomendado para uso de produção)"

#. Tag: literal
#: performance.xml:644
#, fuzzy, no-c-format
msgid "org.hibernate.cache.HashtableCacheProvider"
msgstr "<literal>org.hibernate.cache.HashtableCacheProvider"

#. Tag: entry
#: performance.xml:646
#, no-c-format
msgid "memory"
msgstr "memória"

#. Tag: entry
#: performance.xml:650 performance.xml:662 performance.xml:674
#: performance.xml:992 performance.xml:994 performance.xml:996
#: performance.xml:1004 performance.xml:1006 performance.xml:1008
#: performance.xml:1016 performance.xml:1018 performance.xml:1020
#: performance.xml:1028 performance.xml:1030 performance.xml:1040
#: performance.xml:1046 performance.xml:1052 performance.xml:1058
#, no-c-format
msgid "<entry>yes"
msgstr ""

#. Tag: entry
#: performance.xml:654 performance.xml:1002
#, no-c-format
msgid "EHCache"
msgstr "EHCache"

#. Tag: literal
#: performance.xml:656
#, fuzzy, no-c-format
msgid "org.hibernate.cache.EhCacheProvider"
msgstr "<literal>org.hibernate.cache.EhCacheProvider"

#. Tag: entry
#: performance.xml:658 performance.xml:670
#, no-c-format
msgid "memory, disk"
msgstr "memória, disco"

#. Tag: entry
#: performance.xml:666 performance.xml:1014
#, no-c-format
msgid "OSCache"
msgstr "OSCache"

#. Tag: literal
#: performance.xml:668
#, fuzzy, no-c-format
msgid "org.hibernate.cache.OSCacheProvider"
msgstr "<literal>org.hibernate.cache.OSCacheProvider"

#. Tag: entry
#: performance.xml:678 performance.xml:1026
#, no-c-format
msgid "SwarmCache"
msgstr "SwarmCache"

#. Tag: literal
#: performance.xml:680
#, fuzzy, no-c-format
msgid "org.hibernate.cache.SwarmCacheProvider"
msgstr "<literal>org.hibernate.cache.SwarmCacheProvider"

#. Tag: entry
#: performance.xml:682
#, no-c-format
msgid "clustered (ip multicast)"
msgstr "clustered (ip multicast)"

#. Tag: entry
#: performance.xml:684
#, no-c-format
msgid "yes (clustered invalidation)"
msgstr "sim (invalidação em cluster)"

#. Tag: entry
#: performance.xml:690 performance.xml:1038
#, no-c-format
msgid "JBoss Cache 1.x"
msgstr "JBoss Cache 1.x"

#. Tag: literal
#: performance.xml:692
#, fuzzy, no-c-format
msgid "org.hibernate.cache.TreeCacheProvider"
msgstr "<literal>org.hibernate.cache.TreeCacheProvider"

#. Tag: entry
#: performance.xml:694 performance.xml:706
#, no-c-format
msgid "clustered (ip multicast), transactional"
msgstr "(ip multicast) em cluster, transacional"

#. Tag: entry
#: performance.xml:696
#, no-c-format
msgid "yes (replication)"
msgstr "sim (replicação)"

#. Tag: entry
#: performance.xml:698 performance.xml:710
#, no-c-format
msgid "yes (clock sync req.)"
msgstr "sim (solicitação de sync. de relógio)"

#. Tag: entry
#: performance.xml:702 performance.xml:1050
#, no-c-format
msgid "JBoss Cache 2"
msgstr "JBoss Cache 2"

#. Tag: literal
#: performance.xml:704
#, fuzzy, no-c-format
msgid "org.hibernate.cache.jbc.JBossCacheRegionFactory"
msgstr "<literal>org.hibernate.cache.jbc.JBossCacheRegionFactory"

#. Tag: entry
#: performance.xml:708
#, no-c-format
msgid "yes (replication or invalidation)"
msgstr "sim (invalidação ou replicação)"

#. Tag: title
#: performance.xml:717
#, no-c-format
msgid "Cache mappings"
msgstr "Mapeamento de Cache"

#. Tag: para
#: performance.xml:719
#, no-c-format
msgid ""
"As we have done in previous chapters we are looking at the two different "
"possibiltites to configure caching. First configuration via annotations and "
"then via Hibernate mapping files."
msgstr ""

#. Tag: para
#: performance.xml:723
#, no-c-format
msgid ""
"By default, entities are not part of the second level cache and we recommend "
"you to stick to this setting. However, you can override this by setting the "
"<literal>shared-cache-mode element in your persistence."
"xml</filename> file or by using the javax.persistence.sharedCache."
"mode </literal>property in your configuration. The following values are "
"possible:"
msgstr ""

#. Tag: para
#: performance.xml:732
#, no-c-format
msgid ""
"<literal>ENABLE_SELECTIVE (Default and recommended value): "
"entities are not cached unless explicitly marked as cacheable."
msgstr ""

#. Tag: para
#: performance.xml:738
#, no-c-format
msgid ""
"<literal>DISABLE_SELECTIVE: entities are cached unless explicitly "
"marked as not cacheable."
msgstr ""

#. Tag: para
#: performance.xml:743
#, no-c-format
msgid ""
"<literal>ALL: all entities are always cached even if marked as non "
"cacheable."
msgstr ""

#. Tag: para
#: performance.xml:748
#, no-c-format
msgid ""
"<literal>NONE: no entity are cached even if marked as cacheable. "
"This option can make sense to disable second-level cache altogether."
msgstr ""

#. Tag: para
#: performance.xml:754
#, no-c-format
msgid ""
"The cache concurrency strategy used by default can be set globaly via the "
"<literal>hibernate.cache.default_cache_concurrency_strategy "
"configuration property. The values for this property are:"
msgstr ""

#. Tag: literal
#: performance.xml:761
#, fuzzy, no-c-format
msgid "<literal>read-only"
msgstr "consultas por <literal>Criteria "

#. Tag: literal
#: performance.xml:765
#, fuzzy, no-c-format
msgid "<literal>read-write"
msgstr "consultas por <literal>Criteria "

#. Tag: literal
#: performance.xml:769
#, fuzzy, no-c-format
msgid "<literal>nonstrict-read-write"
msgstr "leitura-escrita não estrita"

#. Tag: literal
#: performance.xml:773
#, fuzzy, no-c-format
msgid "<literal>transactional"
msgstr "consultas por <literal>Criteria "

#. Tag: para
#: performance.xml:778
#, no-c-format
msgid ""
"It is recommended to define the cache concurrency strategy per entity rather "
"than using a global one. Use the <classname>@org.hibernate.annotations."
"Cache</classname> annotation for that."
msgstr ""

#. Tag: title
#: performance.xml:785
#, no-c-format
msgid ""
"Definition of cache concurrency strategy via <classname>@Cache"
msgstr ""

#. Tag: programlisting
#: performance.xml:788
#, no-c-format
msgid ""
"@Entity \n"
"@Cacheable\n"
"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n"
"public class Forest { ... }"
msgstr ""

#. Tag: para
#: performance.xml:791
#, no-c-format
msgid ""
"Hibernate also let's you cache the content of a collection or the "
"identifiers if the collection contains other entities. Use the "
"<classname>@Cache annotation on the collection property."
msgstr ""

#. Tag: title
#: performance.xml:797
#, fuzzy, no-c-format
msgid "Caching collections using annotations"
msgstr "Inicializando coleções e proxies"

#. Tag: programlisting
#: performance.xml:799
#, no-c-format
msgid ""
"@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)\n"
"@JoinColumn(name=\"CUST_ID\")\n"
"@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)\n"
"public SortedSet<Ticket> getTickets() {\n"
"    return tickets;\n"
"}"
msgstr ""

#. Tag: para
#: performance.xml:802
#, no-c-format
msgid ""
"shows the<literal> @org.hibernate.annotations.Cache annotations "
"with its attributes. It allows you to define the caching strategy and region "
"of a given second level cache."
msgstr ""

#. Tag: title
#: performance.xml:808
#, no-c-format
msgid "<classname>@Cache annotation with attributes"
msgstr ""

#. Tag: programlisting
#: performance.xml:820
#, no-c-format
msgid ""
"@Cache(\n"
"    CacheConcurrencyStrategy usage();\n"
"    String region() default \"\";\n"
"    String include() default \"all\";\n"
")"
msgstr ""

#. Tag: para
#: performance.xml:824
#, no-c-format
msgid ""
"usage: the given cache concurrency strategy (NONE, READ_ONLY, "
"NONSTRICT_READ_WRITE, READ_WRITE, TRANSACTIONAL)"
msgstr ""

#. Tag: para
#: performance.xml:830
#, no-c-format
msgid ""
"region (optional): the cache region (default to the fqcn of the class or the "
"fq role name of the collection)"
msgstr ""

#. Tag: para
#: performance.xml:835
#, no-c-format
msgid ""
"<literal>include (optional): all to include all properties, non-"
"lazy to only include non lazy properties (default all)."
msgstr ""

#. Tag: para
#: performance.xml:843
#, no-c-format
msgid ""
"Let's now take a look at Hibernate mapping files. There the <literal><"
"cache></literal> element of a class or collection mapping is used to "
"configure the second level cache. Looking at <xref linkend=\"example-"
"hibernate-cache-mapping-element\"/> the parallels to anotations is obvious."
msgstr ""

#. Tag: title
#: performance.xml:850
#, no-c-format
msgid "The Hibernate <literal><cache> mapping element"
msgstr ""

#. Tag: programlisting
#: performance.xml:862
#, no-c-format
msgid ""
"<cache\n"
"    usage=\"transactional|read-write|nonstrict-read-write|read-only\"\n"
"    region=\"RegionName\"\n"
"    include=\"all|non-lazy\"\n"
"/>"
msgstr ""

#. Tag: para
#: performance.xml:866
#, no-c-format
msgid ""
"<literal>usage (required) specifies the caching strategy: "
"<literal>transactional, read-write, "
"<literal>nonstrict-read-write or read-only"
msgstr ""
"<literal>uso (solicitado) especifica a estratégia de cache: "
"<literal>transacional, leitura-escrita, "
"<literal>leitura-escrita não estrito ou somente leitura (optional: defaults to the class or collection "
"role name): specifies the name of the second level cache region"
msgstr ""
"<literal>region (opcional: padrão à classe ou nome papel da "
"coleção): especifica o nome da região do cache de segundo nível"

#. Tag: para
#: performance.xml:880
#, no-c-format
msgid ""
"<literal>include (optional: defaults to all) "
"<literal>non-lazy: specifies that properties of the entity mapped "
"with <literal>lazy=\"true\" cannot be cached when attribute-level "
"lazy fetching is enabled"
msgstr ""
"<literal>include (opcional: padrão para all) "
"<literal>non-lazy: especifica que a propriedade da entidade "
"mapeada com <literal>lazy=\"true\" pode não estar em cache quando "
"o nível da função busca lazy for habilitada"

#. Tag: para
#: performance.xml:890
#, fuzzy, no-c-format
msgid ""
"Alternatively to <literal><cache>, you can use <"
"class-cache></literal> and <collection-cache> "
"elements in <literal>hibernate.cfg.xml."
msgstr ""
"De forma alternativa, você poderá especificar os elementos <literal><"
"class-cache></literal> e <collection-cache> em "
"<literal>hibernate.cfg.xml."

#. Tag: para
#: performance.xml:895
#, no-c-format
msgid "Let's now have a closer look at the different usage strategies"
msgstr ""

#. Tag: title
#: performance.xml:900
#, no-c-format
msgid "Strategy: read only"
msgstr "Estratégia: somente leitura"

#. Tag: para
#: performance.xml:902
#, no-c-format
msgid ""
"If your application needs to read, but not modify, instances of a persistent "
"class, a <literal>read-only cache can be used. This is the "
"simplest and optimal performing strategy. It is even safe for use in a "
"cluster."
msgstr ""
"Se sua aplicação precisar ler mas nunca modificar instâncias de uma classe "
"persistente, pode-se utilizar um cache de <literal>read-only. Esta "
"é a estratégia de desempenho mais simples e melhor. É também perfeitamente "
"seguro para uso em um cluster."

#. Tag: title
#: performance.xml:909
#, no-c-format
msgid "Strategy: read/write"
msgstr "Estratégia: leitura/escrita"

#. Tag: para
#: performance.xml:911
#, no-c-format
msgid ""
"If the application needs to update data, a <literal>read-write "
"cache might be appropriate. This cache strategy should never be used if "
"serializable transaction isolation level is required. If the cache is used "
"in a JTA environment, you must specify the property <literal>hibernate."
"transaction.manager_lookup_class</literal> and naming a strategy for "
"obtaining the JTA <literal>TransactionManager. In other "
"environments, you should ensure that the transaction is completed when "
"<literal>Session.close() or Session.disconnect() support locking."
msgstr ""
"Se a aplicação precisar atualizar dados, um cache de <literal>read-write, nomeando uma "
"estratégia por obter o <literal>TransactionManager JTA. Em outros "
"ambientes, você deve assegurar que a transação está completa quando a "
"<literal>Session.close() ou Session.disconnect() suportam "
"o bloqueamento."

#. Tag: title
#: performance.xml:927
#, no-c-format
msgid "Strategy: nonstrict read/write"
msgstr "Estratégia: leitura/escrita não estrita"

#. Tag: para
#: performance.xml:929
#, no-c-format
msgid ""
"If the application only occasionally needs to update data (i.e. if it is "
"extremely unlikely that two transactions would try to update the same item "
"simultaneously), and strict transaction isolation is not required, a "
"<literal>nonstrict-read-write cache might be appropriate. If the "
"cache is used in a JTA environment, you must specify <literal>hibernate."
"transaction.manager_lookup_class</literal>. In other environments, you "
"should ensure that the transaction is completed when <literal>Session.close()"
"</literal> or Session.disconnect() is called."
msgstr ""
"Se a aplicação somente precisa atualizar dados ocasionalmente (ou seja, se "
"for extremamente improvável que as duas transações tentem atualizar o mesmo "
"ítem simultaneamente) e não for requerido uma isolação de transação estrita, "
"o uso deum cache de <literal>nonstrict-read-write pode ser mais "
"apropriado. Se um cache é usado em ambiente JTA, você deverá especificar o "
"<literal>hibernate.transaction.manager_lookup_class. Em outros "
"ambientes, você deve assegurar que a transação está completa quando a "
"<literal>Session.close() ou Session.disconnect() cache strategy provides support for "
"fully transactional cache providers such as JBoss TreeCache. Such a cache "
"can only be used in a JTA environment and you must specify "
"<literal>hibernate.transaction.manager_lookup_class."
msgstr ""
"A estratégia de cache <literal>transactional provê suporte para "
"provedores de cache transacional completo como o JBoss TreeCache. Tal cache, "
"deve ser usado somente em um ambiente JTA e você deverá especificar o "
"<literal>hibernate.transaction.manager_lookup_class."

#. Tag: title
#: performance.xml:950
#, no-c-format
msgid "Cache-provider/concurrency-strategy compatibility"
msgstr "Compatibilidade de Estratégia de Concorrência de Cache Provedor"

#. Tag: para
#: performance.xml:953
#, no-c-format
msgid ""
"None of the cache providers support all of the cache concurrency strategies."
msgstr ""
"Nenhum provedor de cache suporta todas as estratégias de concorrência de "
"cache. "

#. Tag: para
#: performance.xml:957
#, no-c-format
msgid ""
"The following table shows which providers are compatible with which "
"concurrency strategies."
msgstr ""
"A seguinte tabela mostra qual provedor é compatível com qual estratégia de "
"concorrência. "

#. Tag: title
#: performance.xml:961
#, no-c-format
msgid "Cache Concurrency Strategy Support"
msgstr "Suporte de Estratégia de Concorrência de Cache"

#. Tag: entry
#: performance.xml:978
#, no-c-format
msgid "<entry>read-only"
msgstr ""

#. Tag: entry
#: performance.xml:980
#, fuzzy, no-c-format
msgid "<entry>nonstrict-read-write"
msgstr "leitura-escrita não estrita"

#. Tag: entry
#: performance.xml:982
#, no-c-format
msgid "<entry>read-write"
msgstr ""

#. Tag: entry
#: performance.xml:984
#, fuzzy, no-c-format
msgid "<entry>transactional"
msgstr "transacional"

#. Tag: title
#: performance.xml:1067
#, no-c-format
msgid "Managing the caches"
msgstr "Gerenciando os caches"

#. Tag: para
#: performance.xml:1069
#, no-c-format
msgid ""
"Whenever you pass an object to <literal>save(), update()saveOrUpdate(), and whenever you retrieve an "
"object using <literal>load(), get(), "
"<literal>list(), iterate() or scroll()"
"</literal>, that object is added to the internal cache of the "
"<literal>Session."
msgstr ""
"Quando passar um objeto para <literal>save(), update()saveOrUpdate() e quando recuperar um objeto "
"usando um <literal>load(), get(), list"
"()</literal>, iterate() ou scroll(), "
"este objeto será adicionado ao cache interno da <literal>Session."

#. Tag: para
#: performance.xml:1076
#, no-c-format
msgid ""
"When <literal>flush() is subsequently called, the state of that "
"object will be synchronized with the database. If you do not want this "
"synchronization to occur, or if you are processing a huge number of objects "
"and need to manage memory efficiently, the <literal>evict() method "
"can be used to remove the object and its collections from the first-level "
"cache."
msgstr ""
"Quando o <literal>flush() for subsequentemente chamado, o estado "
"deste objeto será sincronizado com o banco de dados. Se você não desejar que "
"esta sincronização aconteça ou se você estiver processando uma grande "
"quantidade de objetos e precisar gerenciar a memória de forma eficiente, o "
"método <literal>evict() pode ser usado para remover o objeto de "
"suas coleções de cache de primeiro nível."

#. Tag: title
#: performance.xml:1084
#, no-c-format
msgid ""
"Explcitly evicting a cached instance from the first level cache using "
"<methodname>Session.evict()"
msgstr ""

#. Tag: programlisting
#: performance.xml:1087
#, no-c-format
msgid ""
"ScrollableResult cats = sess.createQuery(\"from Cat as cat\").scroll(); //a "
"huge result set\n"
"while ( cats.next() ) {\n"
"    Cat cat = (Cat) cats.get(0);\n"
"    doSomethingWithACat(cat);\n"
"    sess.evict(cat);\n"
"}"
msgstr ""

#. Tag: para
#: performance.xml:1090
#, no-c-format
msgid ""
"The <literal>Session also provides a contains() "
"method to determine if an instance belongs to the session cache."
msgstr ""
"A <literal>Session também oferece um métodocontains()"

#. Tag: para
#: performance.xml:1097
#, no-c-format
msgid ""
"For the second-level cache, there are methods defined on "
"<literal>SessionFactory for evicting the cached state of an "
"instance, entire class, collection instance or entire collection role."
msgstr ""
"Para o cache de segundo nível, existem métodos definidos na "
"<literal>SessionFactory para despejar o estado de cache de uma "
"instância, classe inteira, instância de coleção ou papel de coleção inteiro."

#. Tag: title
#: performance.xml:1103
#, no-c-format
msgid ""
"Second-level cache eviction via <methodname>SessionFactoty.evict() SessionFacyory.evictCollection()"
msgstr ""

#. Tag: programlisting
#: performance.xml:1107
#, no-c-format
msgid ""
"sessionFactory.evict(Cat.class, catId); //evict a particular Cat\n"
"sessionFactory.evict(Cat.class);  //evict all Cats\n"
"sessionFactory.evictCollection(\"Cat.kittens\", catId); //evict a particular "
"collection of kittens\n"
"sessionFactory.evictCollection(\"Cat.kittens\"); //evict all kitten "
"collections"
msgstr ""

#. Tag: para
#: performance.xml:1110
#, no-c-format
msgid ""
"The <literal>CacheMode controls how a particular session interacts "
"with the second-level cache:"
msgstr ""
"O <literal>CacheMode controla como uma sessão em particular "
"interage com o cache de segundo nível:"

#. Tag: para
#: performance.xml:1115
#, no-c-format
msgid ""
"<literal>CacheMode.NORMAL: will read items from and write items to "
"the second-level cache"
msgstr ""
"<literal>CacheMode.NORMAL - lê e escreve itens ao cache de segundo "
"nível."

#. Tag: para
#: performance.xml:1120
#, no-c-format
msgid ""
"<literal>CacheMode.GET: will read items from the second-level "
"cache. Do not write to the second-level cache except when updating data"
msgstr ""
"<literal>CacheMode.GET: itens de leitura do cache de segundo "
"nível. Não escreve ao cache de segundo nível, exceto quando atualizar dados."

#. Tag: para
#: performance.xml:1126
#, no-c-format
msgid ""
"<literal>CacheMode.PUT: will write items to the second-level "
"cache. Do not read from the second-level cache"
msgstr ""
"<literal>CacheMode.PUT: escreve itens ao cache de segundo nível. "
"Não lê a partir do cache de segundo nível."

#. Tag: para
#: performance.xml:1131
#, no-c-format
msgid ""
"<literal>CacheMode.REFRESH: will write items to the second-level "
"cache. Do not read from the second-level cache. Bypass the effect of "
"<literal>hibernate.cache.use_minimal_puts forcing a refresh of the "
"second-level cache for all items read from the database"
msgstr ""
"<literal>CacheMode.REFRESH: escreve itens ao cache de segundo "
"nível, mas não lê a partir do cache de segundo nível. Passa o efeito de "
"<literal>hibernate.cache.use_minimal_puts, forçando uma "
"atualização do cache de segundo nível para que todos os itens leiam a partir "
"do banco de dados. "

#. Tag: para
#: performance.xml:1139
#, no-c-format
msgid ""
"To browse the contents of a second-level or query cache region, use the "
"<literal>Statistics API:"
msgstr ""
"Para navegar o conteúdo do segundo nível ou região de cache de consulta, use "
"o<literal>Statistics API:"

#. Tag: title
#: performance.xml:1143
#, fuzzy, no-c-format
msgid ""
"Browsing the second-level cache entries via the <classname>Statistics API:"

#. Tag: programlisting
#: performance.xml:1146
#, no-c-format
msgid ""
"Map cacheEntries = sessionFactory.getStatistics()\n"
"        .getSecondLevelCacheStatistics(regionName)\n"
"        .getEntries();"
msgstr ""

#. Tag: para
#: performance.xml:1149
#, no-c-format
msgid ""
"You will need to enable statistics and, optionally, force Hibernate to keep "
"the cache entries in a more readable format:"
msgstr ""
"Você precisará habilitar estatísticas e, opcionalmente, forçar o Hibernate a "
"manter as entradas de cache em um formato mais compreensível: "

#. Tag: title
#: performance.xml:1153
#, no-c-format
msgid "Enabling Hibernate statistics"
msgstr ""

#. Tag: programlisting
#: performance.xml:1155
#, no-c-format
msgid ""
"hibernate.generate_statistics true\n"
"hibernate.cache.use_structured_entries true"
msgstr ""

#. Tag: title
#: performance.xml:1160
#, no-c-format
msgid "The Query Cache"
msgstr "O Cache de Consulta"

#. Tag: para
#: performance.xml:1162
#, no-c-format
msgid ""
"Query result sets can also be cached. This is only useful for queries that "
"are run frequently with the same parameters."
msgstr ""
"O conjunto de resultado de consulta pode também estar em cache. Isto é útil, "
"somente para consultas que são rodadas freqüentemente com os mesmos "
"parâmetros. "

#. Tag: title
#: performance.xml:1166
#, no-c-format
msgid "Enabling query caching"
msgstr "Ativação do cache de consulta"

#. Tag: para
#: performance.xml:1168
#, no-c-format
msgid ""
"Caching of query results introduces some overhead in terms of your "
"applications normal transactional processing. For example, if you cache "
"results of a query against Person Hibernate will need to keep track of when "
"those results should be invalidated because changes have been committed "
"against Person. That, coupled with the fact that most applications simply "
"gain no benefit from caching query results, leads Hibernate to disable "
"caching of query results by default. To use query caching, you will first "
"need to enable the query cache:"
msgstr ""
"A aplicação do cache nos resultados de consulta introduz alguns resultados "
"referentes o seu processamento transacional normal de aplicações. Por "
"exemplo, se você realizar o cache nos resultados de uma consulta do Person "
"Hibernate, você precisará acompanhar quando estes resultados deverão ser "
"inválidos devido alterações salvas no Person. Tudo isto, acompanhado com o "
"fato de que a maioria dos aplicativos não recebem benefício algum ao "
"realizar o cache nos resultados da consulta, levando o Hibernate a desativar "
"o cache de resultados de consulta por padrão. Para uso do cache de consulta, "
"você primeiro precisa ativar o cache de consulta:"

#. Tag: programlisting
#: performance.xml:1177
#, no-c-format
msgid "hibernate.cache.use_query_cache true"
msgstr ""

#. Tag: para
#: performance.xml:1179
#, no-c-format
msgid "This setting creates two new cache regions:"
msgstr "Esta configuração cria duas novas regiões de cache:"

#. Tag: para
#: performance.xml:1181
#, no-c-format
msgid ""
"<classname>org.hibernate.cache.StandardQueryCache, holding the "
"cached query results"
msgstr ""
"<classname>org.hibernate.cache.StandardQueryCache, mantendo os "
"resultados da consulta com cache."

#. Tag: para
#: performance.xml:1186
#, no-c-format
msgid ""
"<classname>org.hibernate.cache.UpdateTimestampsCache, holding "
"timestamps of the most recent updates to queryable tables. These are used to "
"validate the results as they are served from the query cache."
msgstr ""
"<classname>org.hibernate.cache.UpdateTimestampsCache, mantém os "
"timestamps das atualizações mais recentes para tabelas consultáveis. Elas "
"são usadas para validar os resultados uma vez que elas são servidas a partir "
"do cache de consulta."

#. Tag: para
#: performance.xml:1194
#, fuzzy, no-c-format
msgid ""
"If you configure your underlying cache implementation to use expiry or "
"timeouts is very important that the cache timeout of the underlying cache "
"region for the UpdateTimestampsCache be set to a higher value than the "
"timeouts of any of the query caches. In fact, we recommend that the the "
"UpdateTimestampsCache region not be configured for expiry at all. Note, in "
"particular, that an LRU cache expiry policy is never appropriate."
msgstr ""
"Se você configurar sua implementação de cache adjacente para usar expirar ou "
"intervalo, é bastante importante que o intervalo do cache da região de cache "
"adjacente para o UpdateTimestampsCache seja coonfigurado num valor mais alto "
"que os intervalos de qualquer um dos caches de consulta. Na realidade, nós "
"recomendamos que a região UpdateTimestampsCache não seja configurada para "
"expirar. Perceba que uma política expirar do cache LRU nunca será apropriada."

#. Tag: para
#: performance.xml:1203
#, no-c-format
msgid ""
"As mentioned above, most queries do not benefit from caching or their "
"results. So by default, individual queries are not cached even after "
"enabling query caching. To enable results caching for a particular query, "
"call <literal>org.hibernate.Query.setCacheable(true). This call "
"allows the query to look for existing cache results or add its results to "
"the cache when it is executed."
msgstr ""
"Conforme mencionado acima, a maioria das consultas não se beneficiam do "
"cache ou de seus resultados. Portanto por padrão, as consultas individuais "
"não estão em cache mesmo depois de ativar o cache de consulta. Para "
"habilitar o caching de resultados, chame <literal>org.hibernate.Query."
"setCacheable(true)</literal>. Esta chamada permite que a consulta procure "
"por resultados de caches existentes ou adicione seus resultados ao cache "
"quando for executado. "

#. Tag: para
#: performance.xml:1211
#, no-c-format
msgid ""
"The query cache does not cache the state of the actual entities in the "
"cache; it caches only identifier values and results of value type. For this "
"reaso, the query cache should always be used in conjunction with the second-"
"level cache for those entities expected to be cached as part of a query "
"result cache (just as with collection caching)."
msgstr ""
"O cache de consulta não realiza o cache ao estado de entidades atuais no "
"cache, ele apenas realiza o cache nos valores identificadores e resultados "
"do tipo de valor. Por esta razão, o cache de consulta deve sempre ser usado "
"em conjunção com o cache de segundo nível para as entidades esperadas a "
"sofrerem o cache como parte de um cache de resultado de consulta (apenas com "
"o cache de coleção)."

#. Tag: title
#: performance.xml:1221
#, no-c-format
msgid "Query cache regions"
msgstr "Regiões de cache de consulta"

#. Tag: para
#: performance.xml:1223
#, no-c-format
msgid ""
"If you require fine-grained control over query cache expiration policies, "
"you can specify a named cache region for a particular query by calling "
"<literal>Query.setCacheRegion()."
msgstr ""
"Se você solicitar um controle de granulado fino com políticas de validade do "
"cache de consulta, você poderá especificar uma região de cache nomeada para "
"uma consulta em particular, chamando <literal>Query.setCacheRegion()."

#. Tag: title
#: performance.xml:1242
#, no-c-format
msgid "Understanding Collection performance"
msgstr "Entendendo o desempenho da Coleção"

#. Tag: para
#: performance.xml:1244
#, no-c-format
msgid ""
"In the previous sections we have covered collections and their applications. "
"In this section we explore some more issues in relation to collections at "
"runtime."
msgstr ""
"Nas seções anteriores nós descrevemos as coleções e seus aplicativos. Nesta "
"seção nós exploraremos mais problemas em relação às coleções no período de "
"execução."

#. Tag: title
#: performance.xml:1249
#, no-c-format
msgid "Taxonomy"
msgstr "Taxonomia"

#. Tag: para
#: performance.xml:1251
#, no-c-format
msgid "Hibernate defines three basic kinds of collections:"
msgstr "O Hibernate define três tipos básicos de coleções:"

#. Tag: para
#: performance.xml:1255
#, no-c-format
msgid "collections of values"
msgstr "Coleções de valores"

#. Tag: para
#: performance.xml:1259
#, no-c-format
msgid "one-to-many associations"
msgstr "Associações um-para-muitos "

#. Tag: para
#: performance.xml:1263
#, no-c-format
msgid "many-to-many associations"
msgstr "Associações muitos-para-muitos "

#. Tag: para
#: performance.xml:1267
#, no-c-format
msgid ""
"This classification distinguishes the various table and foreign key "
"relationships but does not tell us quite everything we need to know about "
"the relational model. To fully understand the relational structure and "
"performance characteristics, we must also consider the structure of the "
"primary key that is used by Hibernate to update or delete collection rows. "
"This suggests the following classification:"
msgstr ""
"A classificação distingue as diversas tabelas e relacionamento de chave "
"externa, mas não nos diz tudo que precisamos saber sobre o modelo "
"relacional. Para entender completamente a estrutura relacional e as "
"características de desempenho, devemos também considerar a estrutura da "
"chave primária que é usada pelo Hibernate para atualizar ou deletar linhas "
"de coleções. Isto sugere a seguinte classificação:"

#. Tag: para
#: performance.xml:1276
#, no-c-format
msgid "indexed collections"
msgstr "Coleções indexadas"

#. Tag: para
#: performance.xml:1280
#, no-c-format
msgid "sets"
msgstr "conjuntos"

#. Tag: para
#: performance.xml:1284
#, no-c-format
msgid "bags"
msgstr "Bags"

#. Tag: para
#: performance.xml:1288
#, no-c-format
msgid ""
"All indexed collections (maps, lists, and arrays) have a primary key "
"consisting of the <literal><key> and <index> e "
"<literal><index>. Neste caso, as atualizações de coleção são "
"geralmente muito eficientes. A chave primária pode ser indexada de forma "
"eficiente e uma linha em particular pode ser localizada de forma eficiente "
"quando o Hibernate tentar atualizar ou deletá-la. "

#. Tag: para
#: performance.xml:1295
#, no-c-format
msgid ""
"Sets have a primary key consisting of <literal><key> and "
"element columns. This can be less efficient for some types of collection "
"element, particularly composite elements or large text or binary fields, as "
"the database may not be able to index a complex primary key as efficiently. "
"However, for one-to-many or many-to-many associations, particularly in the "
"case of synthetic identifiers, it is likely to be just as efficient. If you "
"want <literal>SchemaExport to actually create the primary key of a "
"<literal><set>, you must declare all columns as not-"
"null=\"true\"</literal>."
msgstr ""
"Os conjuntos possuem uma chave primária que consiste em <literal><key>"
"</literal> e colunas de elemento. Isto pode ser menos eficiente para alguns "
"tipos de elementos de coleções, especialmente elementos compostos ou textos "
"grandes ou ainda campos binários. O banco de dados pode não ser capaz de "
"indexar uma chave primária complexa de forma tão eficiente. Por um outro "
"lado, para associações um-para-muitos ou muitos-para-muitos, especialmente "
"no caso de identificadores sintáticos, é bem provável que seja tão eficiente "
"quanto. Se você quiser que o <literal>SchemaExport crie para você "
"uma chave primária de um <literal><set> você deverá declarar "
"todas as colunas como <literal>not-null=\"true\"."

#. Tag: para
#: performance.xml:1306
#, no-c-format
msgid ""
"<literal><idbag> mappings define a surrogate key, so they "
"are efficient to update. In fact, they are the best case."
msgstr ""
"Os mapeamentos <literal><idbag> definem uma chave "
"substituta, para que elas sejam sempre muito eficientes ao atualizar. Na "
"verdade, este é o melhor caso. "

#. Tag: para
#: performance.xml:1309
#, no-c-format
msgid ""
"Bags are the worst case since they permit duplicate element values and, as "
"they have no index column, no primary key can be defined. Hibernate has no "
"way of distinguishing between duplicate rows. Hibernate resolves this "
"problem by completely removing in a single <literal>DELETE and "
"recreating the collection whenever it changes. This can be inefficient."
msgstr ""
"As Bags são os piores casos. Como uma bag permite duplicar valores de "
"elementos e não possui coluna de índice, não se deve definir nenhuma chave "
"primária. O Hibernate não tem como distinguir entre linhas duplicadas. O "
"Hibernate resolve este problema, removendo completamente em um único "
"<literal>DELETE e recria a coleção quando mudar. Isto pode ser "
"bastante ineficiente."

#. Tag: para
#: performance.xml:1316
#, no-c-format
msgid ""
"For a one-to-many association, the \"primary key\" may not be the physical "
"primary key of the database table. Even in this case, the above "
"classification is still useful. It reflects how Hibernate \"locates\" "
"individual rows of the collection."
msgstr ""
"Note que para uma associação um-para-muitos, a chave primária pode não ser a "
"chave primária física da tabela do banco de dados, mas mesmo neste caso, a "
"classificação acima é ainda útil. Isto reflete como o Hibernate \"localiza\" "
"linhas individuais da coleção."

#. Tag: title
#: performance.xml:1323
#, no-c-format
msgid ""
"Lists, maps, idbags and sets are the most efficient collections to update"
msgstr ""
"Listas, mapas, bags de id e conjuntos são coleções mais eficientes para "
"atualizar"

#. Tag: para
#: performance.xml:1326
#, no-c-format
msgid ""
"From the discussion above, it should be clear that indexed collections and "
"sets allow the most efficient operation in terms of adding, removing and "
"updating elements."
msgstr ""
"A partir da discussão acima, deve ficar claro que as coleções indexadas e "
"conjuntos (geralmente) permitem uma operação mais eficente em termos de "
"adição, remoção e atualização de elementos.  "

#. Tag: para
#: performance.xml:1330
#, no-c-format
msgid ""
"There is, arguably, one more advantage that indexed collections have over "
"sets for many-to-many associations or collections of values. Because of the "
"structure of a <literal>Set, Hibernate does not UPDATESetINSERT and DELETEUPDATE em "
"uma linha quando um elemento é \"modificado\". As mudanças para o <literal> "
"Conjunto</literal> funcionam sempre através do comando INSERTDELETE de linhas individuais. Novamente, esta "
"consideração não se aplica às associações um para muitos. "

#. Tag: para
#: performance.xml:1338
#, no-c-format
msgid ""
"After observing that arrays cannot be lazy, you can conclude that lists, "
"maps and idbags are the most performant (non-inverse) collection types, with "
"sets not far behind. You can expect sets to be the most common kind of "
"collection in Hibernate applications. This is because the \"set\" semantics "
"are most natural in the relational model."
msgstr ""
"Após observar que as matrizes não podem ser preguiçosas, nós concluimos que "
"as listas, mapas e bags de id são tipos de coleções com maior desempenho "
"(não inverso), com conjuntos que não ficam atrás. Espera-se que os conjuntos "
"sejam um tipo mais comum de coleção nas aplicações Hibernate. Isto porque as "
"semânticas \"conjunto\" são mais naturais em modelos relacionais. "

#. Tag: para
#: performance.xml:1344
#, no-c-format
msgid ""
"However, in well-designed Hibernate domain models, most collections are in "
"fact one-to-many associations with <literal>inverse=\"true\". For "
"these associations, the update is handled by the many-to-one end of the "
"association, and so considerations of collection update performance simply "
"do not apply."
msgstr ""
"No entanto, em modelos de domínio de Hibernate bem criados, geralmente vemos "
"que a maioria das coleções são de fato, associações um-para-muitos com "
"<literal>inverse=\"true\". Para estas associações, a atualização é "
"manipulada pelo lado muitos-para-um de uma associação e portanto "
"considerações de desempenho de atualização de coleção simplesmente não se "
"aplicam a este caso.  "

#. Tag: title
#: performance.xml:1352
#, no-c-format
msgid "Bags and lists are the most efficient inverse collections"
msgstr "As Bags e listas são as coleções de inversão mais eficientes."

#. Tag: para
#: performance.xml:1354
#, no-c-format
msgid ""
"There is a particular case, however, in which bags, and also lists, are much "
"more performant than sets. For a collection with <literal>inverse=\"true\", "
"<literal>Collection.add() or Collection.addAll()List. This "
"can make the following common code much faster:"
msgstr ""
"Existe um caso em particular no qual as bags (e também as listas) possuem um "
"desempenho muito maior do que conjuntos. Para uma coleção com "
"<literal>inverse=\"true\", o idioma de relacionamento um-para-um "
"bidirecional padrão, por exemplo, podemos adicionar elementos a uma bag ou "
"uma lista sem precisar inicializar (buscar) os elementos da bag. Isto "
"acontece porque a <literal>Collection.add() ou Collection."
"addAll()</literal> deve sempre retornar verdadeira para uma bag ou "
"<literal>List. Isto pode fazer que o código comum seguinte seja "
"muito mais rápido:"

#. Tag: programlisting
#: performance.xml:1365
#, no-c-format
msgid ""
"Parent p = (Parent) sess.load(Parent.class, id);\n"
"Child c = new Child();\n"
"c.setParent(p);\n"
"p.getChildren().add(c);  //no need to fetch the collection!\n"
"sess.flush();"
msgstr ""

#. Tag: title
#: performance.xml:1369
#, no-c-format
msgid "One shot delete"
msgstr "Deletar uma vez"

#. Tag: para
#: performance.xml:1371
#, no-c-format
msgid ""
"Deleting collection elements one by one can sometimes be extremely "
"inefficient. Hibernate knows not to do that in the case of an newly-empty "
"collection (if you called <literal>list.clear(), for example). In "
"this case, Hibernate will issue a single <literal>DELETE."
msgstr ""
"Às vezes, deletar elementos de coleção um por um pode ser extremamente "
"ineficiente. O Hibernate não é completamente burro, portanto ele sabe que "
"não deve fazer isso no caso de uma coleção que tenha sido esvaziada "
"recentemente (se você chamou <literal>list.clear(), por exemplo). "
"Neste caso, o Hibernate irá editar um único <literal>DELETE."

#. Tag: para
#: performance.xml:1377
#, no-c-format
msgid ""
"Suppose you added a single element to a collection of size twenty and then "
"remove two elements. Hibernate will issue one <literal>INSERT "
"statement and two <literal>DELETE statements, unless the "
"collection is a bag. This is certainly desirable."
msgstr ""
"Vamos supor que tenha adicionado um elemento único à uma coleção de tamanho "
"vinte e então remove dois elementos. O Hibernate irá editar uma instrução "
"<literal>INSERT e duas instruções DELETE, a não "
"ser que a coleção seja uma bag. Isto é certamente desejável."

#. Tag: para
#: performance.xml:1383
#, no-c-format
msgid ""
"However, suppose that we remove eighteen elements, leaving two and then add "
"thee new elements. There are two possible ways to proceed"
msgstr ""
"No entanto, suponha que removamos dezoito elementos, deixando dois e então "
"adicionando três novos elementos. Existem duas formas possíveis de se "
"proceder:"

#. Tag: para
#: performance.xml:1389
#, no-c-format
msgid "delete eighteen rows one by one and then insert three rows"
msgstr "delete dezoito linhas uma por uma e então insira três linhas"

#. Tag: para
#: performance.xml:1394
#, no-c-format
msgid ""
"remove the whole collection in one SQL <literal>DELETE and insert "
"all five current elements one by one"
msgstr ""
"remova toda a coleção em um SQL <literal>DELETE e insira todos os "
"cinco elementos atuais, um por um"

#. Tag: para
#: performance.xml:1400
#, no-c-format
msgid ""
"Hibernate cannot know that the second option is probably quicker. It would "
"probably be undesirable for Hibernate to be that intuitive as such behavior "
"might confuse database triggers, etc."
msgstr ""
"O Hibernate não sabe que a segunda opção é provavelmente mais rápida neste "
"caso. O Hibernate não deseha saber a opção, uma vez que tal comportamento "
"deve confundir os triggers do banco de dados, etc."

#. Tag: para
#: performance.xml:1404
#, no-c-format
msgid ""
"Fortunately, you can force this behavior (i.e. the second strategy) at any "
"time by discarding (i.e. dereferencing) the original collection and "
"returning a newly instantiated collection with all the current elements."
msgstr ""
"Felizmente, você pode forçar este comportamento (ou seja, uma segunda "
"estratégia) a qualquer momento, descartando (ou seja, desreferenciando) a "
"coleção original e retornando uma coleção recentemente instanciada com todos "
"os elementos atuais. "

#. Tag: para
#: performance.xml:1409
#, no-c-format
msgid ""
"One-shot-delete does not apply to collections mapped <literal>inverse=\"true"
"\"</literal>."
msgstr ""
"É claro que, deletar somente uma vez, não se aplica às coleções mapeadas "
"<literal>inverse=\"true\"."

#. Tag: title
#: performance.xml:1415
#, no-c-format
msgid "Monitoring performance"
msgstr "Monitorando desempenho"

#. Tag: para
#: performance.xml:1417
#, no-c-format
msgid ""
"Optimization is not much use without monitoring and access to performance "
"numbers. Hibernate provides a full range of figures about its internal "
"operations. Statistics in Hibernate are available per "
"<literal>SessionFactory."
msgstr ""
"A otimização não é muito usada sem o monitoramento e acesso ao número de "
"desempenho. O Hibernate oferece uma grande variedade de números sobre suas "
"operações internas. Estatísticas em Hibernate estão disponíveis através do "
"<literal>SessionFactory."

#. Tag: title
#: performance.xml:1423
#, no-c-format
msgid "Monitoring a SessionFactory"
msgstr "Monitorando uma SessionFactory"

#. Tag: para
#: performance.xml:1425
#, no-c-format
msgid ""
"You can access <literal>SessionFactory metrics in two ways. Your "
"first option is to call <literal>sessionFactory.getStatistics() "
"and read or display the <literal>Statistics yourself."
msgstr ""
"Você poderá acessar as métricas da <literal>SessionFactory de duas "
"formas. Sua primeira opção é chamar a <literal>sessionFactory.getStatistics()"
"</literal> e ler ou dispôr as Estatísticas você mesmo."

#. Tag: para
#: performance.xml:1430
#, no-c-format
msgid ""
"Hibernate can also use JMX to publish metrics if you enable the "
"<literal>StatisticsService MBean. You can enable a single MBean "
"for all your <literal>SessionFactory or one per factory. See the "
"following code for minimalistic configuration examples:"
msgstr ""
"O Hibernate também usa o JMX para publicar métricas se você habilitar o "
"MBean de <literal>StatisticsService. Você deve habiliar um MBean "
"único para todas as suas <literal>SessionFactory ou uma por "
"factory. Veja o seguinte código para exemplos de configurações "
"minimalísticos: "

#. Tag: programlisting
#: performance.xml:1435
#, no-c-format
msgid ""
"// MBean service registration for a specific SessionFactory\n"
"Hashtable tb = new Hashtable();\n"
"tb.put(\"type\", \"statistics\");\n"
"tb.put(\"sessionFactory\", \"myFinancialApp\");\n"
"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n"
"\n"
"StatisticsService stats = new StatisticsService(); // MBean implementation\n"
"stats.setSessionFactory(sessionFactory); // Bind the stats to a "
"SessionFactory\n"
"server.registerMBean(stats, on); // Register the Mbean on the server"
msgstr ""

#. Tag: programlisting
#: performance.xml:1437
#, no-c-format
msgid ""
"// MBean service registration for all SessionFactory's\n"
"Hashtable tb = new Hashtable();\n"
"tb.put(\"type\", \"statistics\");\n"
"tb.put(\"sessionFactory\", \"all\");\n"
"ObjectName on = new ObjectName(\"hibernate\", tb); // MBean object name\n"
"\n"
"StatisticsService stats = new StatisticsService(); // MBean implementation\n"
"server.registerMBean(stats, on); // Register the MBean on the server"
msgstr ""

#. Tag: para
#: performance.xml:1439
#, no-c-format
msgid ""
"You can activate and deactivate the monitoring for a "
"<literal>SessionFactory:"
msgstr ""
"Você pode (des)ativar o monitoramento para uma <literal>SessionFactory "
"to <literal>false"
msgstr ""
"no tempo de configuração, ajuste <literal>hibernate.generate_statisticsfalso"

#. Tag: para
#: performance.xml:1452
#, no-c-format
msgid ""
"at runtime: <literal>sf.getStatistics().setStatisticsEnabled(true) "
"or <literal>hibernateStatsBean.setStatisticsEnabled(true)"
msgstr ""
"em tempo de espera: <literal>sf.getStatistics().setStatisticsEnabled(true)hibernateStatsBean.setStatisticsEnabled(true)"

#. Tag: para
#: performance.xml:1458
#, no-c-format
msgid ""
"Statistics can be reset programmatically using the <literal>clear() method."
msgstr ""
"As estatísticas podem ser reajsutadas de forma programática, usando o método "
"<literal>clear(). Um resumo pode ser enviado para o usuário (nível "
"de info) usando o método <literal>logSummary(). "

#. Tag: title
#: performance.xml:1464
#, no-c-format
msgid "Metrics"
msgstr "Métricas"

#. Tag: para
#: performance.xml:1466
#, no-c-format
msgid ""
"Hibernate provides a number of metrics, from basic information to more "
"specialized information that is only relevant in certain scenarios. All "
"available counters are described in the <literal>Statistics "
"interface API, in three categories:"
msgstr ""
"O Hibernate oferece um número de métricas, desde informações bem básicas até "
"especializadas, somente relevantes a certos cenários. Todos os contadores "
"disponíveis estão descritos na API da interface <literal>Statistics usage, such as "
"number of open sessions, retrieved JDBC connections, etc."
msgstr ""
"As métricas relacionadas ao uso da <literal>Sessão, tal como um "
"número de sessões em aberto, conexões JDBC recuperadas, etc."

#. Tag: para
#: performance.xml:1479
#, no-c-format
msgid ""
"Metrics related to the entities, collections, queries, and caches as a whole "
"(aka global metrics)."
msgstr ""
"As métricas relacionadas às entidades, coleções, consultas e caches como um "
"todo (mais conhecido como métricas globais). "

#. Tag: para
#: performance.xml:1484
#, no-c-format
msgid ""
"Detailed metrics related to a particular entity, collection, query or cache "
"region."
msgstr ""
"Métricas detalhadas relacionadas à uma entidade em particular, coleção, "
"consulta ou região de cache."

#. Tag: para
#: performance.xml:1489
#, no-c-format
msgid ""
"For example, you can check the cache hit, miss, and put ratio of entities, "
"collections and queries, and the average time a query needs. Be aware that "
"the number of milliseconds is subject to approximation in Java. Hibernate is "
"tied to the JVM precision and on some platforms this might only be accurate "
"to 10 seconds."
msgstr ""
"Por exemplo, você pode verificar a coincidência de um cache, perder e "
"colocar a relação entre as entidades, colações e consultas e tempo médio que "
"uma consulta precisa. Esteja ciente de que o número de milisegundos é "
"sujeito a aproximação em Java. O Hibernate é preso à precisão do JVM, em "
"algumas plataformas a precisão chega a ser de 10 segundos. "

#. Tag: para
#: performance.xml:1495
#, no-c-format
msgid ""
"Simple getters are used to access the global metrics (i.e. not tied to a "
"particular entity, collection, cache region, etc.). You can access the "
"metrics of a particular entity, collection or cache region through its name, "
"and through its HQL or SQL representation for queries. Please refer to the "
"<literal>Statistics, EntityStatistics, "
"<literal>CollectionStatistics, "
"<literal>SecondLevelCacheStatistics, and QueryStatistics, "
"<literal>EntityStatistics, CollectionStatisticsSecondLevelCacheStatistics, e "
"<literal>QueryStatistics para maiores informações. O seguinte "
"código mostra um exemplo simples:  "

#. Tag: programlisting
#: performance.xml:1506
#, no-c-format
msgid ""
"Statistics stats = HibernateUtil.sessionFactory.getStatistics();\n"
"\n"
"double queryCacheHitCount  = stats.getQueryCacheHitCount();\n"
"double queryCacheMissCount = stats.getQueryCacheMissCount();\n"
"double queryCacheHitRatio =\n"
"  queryCacheHitCount / (queryCacheHitCount + queryCacheMissCount);\n"
"\n"
"log.info(\"Query Hit ratio:\" + queryCacheHitRatio);\n"
"\n"
"EntityStatistics entityStats =\n"
"  stats.getEntityStatistics( Cat.class.getName() );\n"
"long changes =\n"
"        entityStats.getInsertCount()\n"
"        + entityStats.getUpdateCount()\n"
"        + entityStats.getDeleteCount();\n"
"log.info(Cat.class.getName() + \" changed \" + changes + \"times\"  );"
msgstr ""

#. Tag: para
#: performance.xml:1508
#, no-c-format
msgid ""
"You can work on all entities, collections, queries and region caches, by "
"retrieving the list of names of entities, collections, queries and region "
"caches using the following methods: <literal>getQueries(), "
"<literal>getEntityNames(), getCollectionRoleNames()getSecondLevelCacheRegionNames()."
msgstr ""
"Para trabalhar em todas as entidades, coleções, consultas e caches "
"regionais, você poderá recuperar os nomes de lista de entidades, coleções, "
"consultas e caches regionais com os seguintes métodos: <literal>getQueries()"
"</literal>, getEntityNames(), "
"<literal>getCollectionRoleNames(), e "
"<literal>getSecondLevelCacheRegionNames(). "

#~ msgid "or even:"
#~ msgstr "ou ainda:"

#~ msgid ""
#~ "Now the following code will actually load both the customer <emphasis>and "
#~ "their orders</emphasis>:"
#~ msgstr ""
#~ "Agora que o código seguinte irá carregar ambos cliente <emphasis>e outros "
#~ "pedidos</emphasis>:"

#~ msgid "yes"
#~ msgstr "sim"

#~ msgid ""
#~ "The <literal><cache> element of a class or collection "
#~ "mapping has the following form:"
#~ msgstr ""
#~ "O elemento <literal><cache> de uma classe ou mapeamento "
#~ "de coleção possui a seguinte forma:"

#~ msgid ""
#~ "The <literal>usage attribute specifies a cache "
#~ "concurrency strategy</emphasis>."
#~ msgstr ""
#~ "A função <literal>uso  especifica uma estratégia de "
#~ "concorrência de cache</emphasis>."

#~ msgid "read-only"
#~ msgstr "somente leitura"

#~ msgid "read-write"
#~ msgstr "leitura-escrita"

Other Hibernate examples (source code examples)

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

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

#1 New Release!

FP Best Seller

 

new blog posts

 

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

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