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

📄 batch.po

📁 hibernate 开源框架的代码 jar包希望大家能喜欢
💻 PO
📖 第 1 页 / 共 2 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 07:47+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: batch.xml:5#, no-c-formatmsgid "Batch processing"msgstr "Processamento de lotes"#. Tag: para#: batch.xml:7#, no-c-formatmsgid """A naive approach to inserting 100 000 rows in the database using Hibernate ""might look like this:"msgstr """Uma alternativa para inserir 100.000 linhas no banco de dados usando o ""Hibernate pode ser a seguinte:"#. Tag: programlisting#: batch.xml:12#, no-c-formatmsgid """<![CDATA[Session session = sessionFactory.openSession();\n""Transaction tx = session.beginTransaction();\n""for ( int i=0; i<100000; i++ ) {\n""    Customer customer = new Customer(.....);\n""    session.save(customer);\n""}\n""tx.commit();\n""session.close();]]>"msgstr ""#. Tag: para#: batch.xml:14#, no-c-formatmsgid """This would fall over with an <literal>OutOfMemoryException</literal> ""somewhere around the 50 000th row. That's because Hibernate caches all the ""newly inserted <literal>Customer</literal> instances in the session-level ""cache."msgstr """Isto irá falhar em algum lugar próximo a linha 50.000, lançando uma ""<literal>OutOfMemoryException</literal>. Isso ocorre devido ao fato do ""Hibernate fazer cache de todas as instâncias de <literal>Customer</literal> ""inseridas num cachê em nível de sessão."#. Tag: para#: batch.xml:20#, no-c-formatmsgid """In this chapter we'll show you how to avoid this problem. First, however, if ""you are doing batch processing, it is absolutely critical that you enable ""the use of JDBC batching, if you intend to achieve reasonable performance. ""Set the JDBC batch size to a reasonable number (say, 10-50):"msgstr """Neste capítulo veremos como contornar esse problema. Entretanto, se você vai ""realizar processamento de lotes, é muito importante que você habilite o uso ""de lotes JDBC, se você pretende obter um desempenho razoável. Defina o ""tamanho do lote JDBC em um valor razoável (algo entre 10-50):"#. Tag: programlisting#: batch.xml:27#, no-c-formatmsgid "<![CDATA[hibernate.jdbc.batch_size 20]]>"msgstr ""#. Tag: para#: batch.xml:29#, no-c-formatmsgid """Note that Hibernate disables insert batching at the JDBC level transparently ""if you use an <literal>identiy</literal> identifier generator."msgstr """Você também pode querer rodar esse tipo de processamento de lotes com o ""cache secundário completamente desabilitado:"#. Tag: para#: batch.xml:34#, no-c-formatmsgid """You also might like to do this kind of work in a process where interaction ""with the second-level cache is completely disabled:"msgstr """Note that Hibernate disables insert batching at the JDBC level transparently ""if you use an <literal>identiy</literal> identifier generator."#. Tag: programlisting#: batch.xml:39#, no-c-formatmsgid "<![CDATA[hibernate.cache.use_second_level_cache false]]>"msgstr ""#. Tag: para#: batch.xml:41#, no-c-formatmsgid """However, this is not absolutely necessary, since we can explicitly set the ""<literal>CacheMode</literal> to disable interaction with the second-level ""cache."msgstr """Mas isto não é absolutamente necessário, desde que nós possamos ajustar o ""<literal>CacheMode</literal> para desabilitar a interação com o cache ""secundário."#. Tag: title#: batch.xml:47#, no-c-formatmsgid "Batch inserts"msgstr "Inserção de lotes"#. Tag: para#: batch.xml:49#, no-c-formatmsgid """When making new objects persistent, you must <literal>flush()</literal> and ""then <literal>clear()</literal> the session regularly, to control the size ""of the first-level cache."msgstr """Quando você estiver inserindo novos objetos persistentes, vocês deve ""executar os métodos <literal>flush()</literal> e <literal>clear()</literal> ""regularmente na sessão, para controlar o tamanho do cache primário."#. Tag: programlisting#: batch.xml:55#, no-c-formatmsgid """<![CDATA[Session session = sessionFactory.openSession();\n""Transaction tx = session.beginTransaction();\n""   \n""for ( int i=0; i<100000; i++ ) {\n""    Customer customer = new Customer(.....);\n""    session.save(customer);\n""    if ( i % 20 == 0 ) { //20, same as the JDBC batch size\n""        //flush a batch of inserts and release memory:\n""        session.flush();\n""        session.clear();\n""    }\n""}\n""   \n""tx.commit();\n""session.close();]]>"msgstr ""#. Tag: title#: batch.xml:60#, no-c-formatmsgid "Batch updates"msgstr "Batch updates"#. Tag: para#: batch.xml:62#, no-c-formatmsgid """For retrieving and updating data the same ideas apply. In addition, you need ""to use <literal>scroll()</literal> to take advantage of server-side cursors ""for queries that return many rows of data."msgstr """Para recuperar e atualizar informações a mesma idéia é válida. ""Adicionalmente, pode precisar usar o <literal>scroll()</literal> para usar ""recursos no lado do servidor em queries que retornam muita informação."#. Tag: programlisting#: batch.xml:68#, no-c-formatmsgid """<![CDATA[Session session = sessionFactory.openSession();\n""Transaction tx = session.beginTransaction();\n""   \n""ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n""    .setCacheMode(CacheMode.IGNORE)\n""    .scroll(ScrollMode.FORWARD_ONLY);\n""int count=0;\n""while ( customers.next() ) {\n""    Customer customer = (Customer) customers.get(0);\n""    customer.updateStuff(...);\n""    if ( ++count % 20 == 0 ) {\n""        //flush a batch of updates and release memory:\n""        session.flush();\n""        session.clear();\n""    }\n""}\n""   \n""tx.commit();\n""session.close();]]>"msgstr ""#. Tag: title#: batch.xml:73#, no-c-formatmsgid "The StatelessSession interface"msgstr "A interface StatelessSession"#. Tag: para#: batch.xml:74#, no-c-formatmsgid """Alternatively, Hibernate provides a command-oriented API that may be used ""for streaming data to and from the database in the form of detached objects. ""A <literal>StatelessSession</literal> has no persistence context associated ""with it and does not provide many of the higher-level life cycle semantics. ""In particular, a stateless session does not implement a first-level cache ""nor interact with any second-level or query cache. It does not implement ""transactional write-behind or automatic dirty checking. Operations performed ""using a stateless session do not ever cascade to associated instances. ""Collections are ignored by a stateless session. Operations performed via a ""stateless session bypass Hibernate's event model and interceptors. Stateless ""sessions are vulnerable to data aliasing effects, due to the lack of a first-""level cache. A stateless session is a lower-level abstraction, much closer ""to the underlying JDBC."msgstr """Alternativamente, o Hibernate provê uma API orientada à comandos, usada para ""transmitir um fluxo de dados de e para o banco de dados na forma de objetos ""soltos. Uma <literal>StatelessSession</literal> não tem um contexto ""persistente associado e não fornece muito das semânticas de alto nível para ""controle do ciclo de vida. Em especial, uma StatelessSession não implemente ""o cache primário e nem interage com o cache secundário ou query cache. Ele ""não implementa salvamento transacional automatico ou checagem automática de ""mudanças. Operação realizadas usando uma StatelessSession não fazem nenhum ""tipo de cascade com as instancias associadas. As coleções são ignoradas por ""uma StatelessSession. Operações realizadas com um StatelessSession ignoram a ""arquitetura de eventos e os interceptadores. StatelessSession são ""vulneráveis aos efeitos do aliasing dos dados, devido a falta do cache ""primário. Uma StatelessSession é uma abstração de baixo nível, muito mais ""próxima do JDBC."#. Tag: programlisting#: batch.xml:89#, no-c-formatmsgid """<![CDATA[StatelessSession session = sessionFactory.openStatelessSession();\n""Transaction tx = session.beginTransaction();\n""   \n""ScrollableResults customers = session.getNamedQuery(\"GetCustomers\")\n""    .scroll(ScrollMode.FORWARD_ONLY);\n""while ( customers.next() ) {\n""    Customer customer = (Customer) customers.get(0);\n""    customer.updateStuff(...);\n""    session.update(customer);\n""}\n""   \n""tx.commit();\n""session.close();]]>"msgstr ""#. Tag: para#: batch.xml:91#, no-c-formatmsgid """Note that in this code example, the <literal>Customer</literal> instances ""returned by the query are immediately detached. They are never associated ""with any persistence context."msgstr """Veja neste exempo, as instancias de <literal>Customer</literal> retornadas ""pela query são imediatamente desvinculadas. Elas nunca serão assossiadas à ""um contexto persistente."#. Tag: para#: batch.xml:97#, no-c-formatmsgid """The <literal>insert(), update()</literal> and <literal>delete()</literal> ""operations defined by the <literal>StatelessSession</literal> interface are ""considered to be direct database row-level operations, which result in ""immediate execution of a SQL <literal>INSERT, UPDATE</literal> or ""<literal>DELETE</literal> respectively. Thus, they have very different ""semantics to the <literal>save(), saveOrUpdate()</literal> and ""<literal>delete()</literal> operations defined by the <literal>Session</""literal> interface."msgstr """As operações <literal>insert(), update()</literal> e <literal>delete()</""literal> definidos pela interface <literal>StatelessSession</literal> são ""considerados operações diretas no banco de dados (row-level operations), ""isso resulta em uma execução imediata de comandos SQL <literal>INSERT, ""UPDATE</literal> ou <literal>DELETE</literal> respectivamente. Devido a ""isso, eles possuem uma semântica bem diferente das operações <literal>save""(), saveOrUpdate()</literal> ou <literal>delete()</literal> definidas na ""interface <literal>Session</literal>."#. Tag: title#: batch.xml:110#, no-c-formatmsgid "DML-style operations"msgstr "Operações no estilo DML"#. Tag: para#: batch.xml:112#, no-c-formatmsgid """As already discussed, automatic and transparent object/relational mapping is ""concerned with the management of object state. This implies that the object ""state is available in memory, hence manipulating (using the SQL ""<literal>Data Manipulation Language</literal> (DML) statements: ""<literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE</""literal>) data directly in the database will not affect in-memory state. ""However, Hibernate provides methods for bulk SQL-style DML statement ""execution which are performed through the Hibernate Query Language (<link ""linkend=\"queryhql\">HQL</link>)."msgstr """Como já discutido, mapeamento objeto/relacional automático e transparente é ""conseguido com a gerência do estado do objeto. Com isto o estado daquele ""objeto fica disponível na memória, manipulando(usando as expressões SQL ""<literal>Data Manipulation Language</literal> (SQL-style DML): ""<literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>DELETE</""literal>) os dados diretamente no banco de dados não irá afetar o estado ""registrado em memória. Entretanto, o Hibernate provê métodos para executar ""queries SQL-style DML, que são totalmente executas com HQL (Hibernate Query ""Language) (<xref linkend=\"queryhql\">HQL</xref>)."#. Tag: para#: batch.xml:122#, no-c-formatmsgid """The pseudo-syntax for <literal>UPDATE</literal> and <literal>DELETE</""literal> statements is: <literal>( UPDATE | DELETE ) FROM? EntityName (WHERE ""where_conditions)?</literal>. Some points to note:"msgstr ""

⌨️ 快捷键说明

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