📄 batch.po
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2007-10-25 07:47+0000\n""PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n""Last-Translator: FULL NAME <EMAIL@ADDRESS>\n""Language-Team: LANGUAGE <LL@li.org>\n""MIME-Version: 1.0\n""Content-Type: text/plain; charset=UTF-8\n""Content-Transfer-Encoding: 8bit\n"#. Tag: title#: batch.xml:5#, no-c-formatmsgid "Batch processing"msgstr "バッチ処理"#. 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 """Hibernateを使ってデータベースに100,000行を挿入する愚直な方法は、このようなも""のです:"#. 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 """これは50,000番目の行のあたりで <literal>OutOfMemoryException</literal> で失敗""するでしょう。 Hibernateがセッションレベルキャッシュで、 新しく挿入されたすべ""ての <literal>Customer</literal> インスタンスをキャッシュするからです。"#. 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 """この章では、この問題を回避する方法を紹介します。 しかしバッチ処理をするなら、""JDBCバッチが使用可能であることが非常に重要です。 そうでなければ手頃なパフォー""マンスが得られません。 JDBCバッチサイズを手頃な数値(例えば、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 """Note that Hibernate disables insert batching at the JDBC level transparently ""if you use an <literal>identiy</literal> identifier generator."#. 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 """また二次キャッシュが全く効かないプロセスで、 このような作業をしたいと思うかも""しれません:"#. 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 """しかし、これは絶対に必要というわけではありません。 なぜなら明示的に ""<literal>CacheMode</literal> を設定して、 二次キャッシュとの相互作用を無効に""することができるからです。"#. Tag: title#: batch.xml:47#, no-c-formatmsgid "Batch inserts"msgstr "バッチ挿入"#. 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 """新しいオブジェクトを永続化するとき、一次キャッシュのサイズを制限するため、 ""セッションを <literal>flush()</literal> して <literal>clear()</literal> しな""ければなりません。"#. 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 "バッチ更新"#. 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 """データを復元したり更新したりするには同じアイディアを適用します。 それに加え""て、データの行を多く返すクエリに対して有効な サーバーサイドのカーソルの利点を""生かしたければ <literal>scroll()</literal> を使う必要があります。"#. 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 "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 """また別の方法として、Hibernateはコマンド指向のAPIを用意しています。 これは分離""オブジェクトの形で、 データベースとのデータストリームのやり取りに使うことがで""きます。 <literal>StatelessSession</literal> は関連する永続コンテキストを持た""ず、 高レベルのライフサイクルセマンティクスの多くを提供しません。 特にステー""トレスセッションは、一時キャッシュを実装せず、 またどのような二次キャッシュや""クエリキャッシュとも相互作用しません。 トランザクショナルなwrite-behindや自動""ダーティチェックも実装しません。 ステートレスセッションを使って行われる操作""が、 関連するインスタンスへカスケードされることは決してありません。 コレク""ションは、ステートレスセッションからは無視されます。 ステートレスセッションを""通して行われる操作は、 Hibernateのイベントモデルやインターセプタの影響を受け""ません。 一時キャッシュを持たないため、 ステートレスセッションは別名を持つ""データに上手く対処できません。 ステートレスセッションは低レベルの抽象化であ""り、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 """このコード例では、クエリが返す <literal>Customer</literal> インスタンスは即座""に(セッションから)分離されることに注意してください。 これは、どのような永続""コンテキストとも決して関連しません。"#. 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 """<literal>StatelessSession</literal> インターフェイスで定義されている ""<literal>insert(), update(), delete()</literal> は、 低レベルの直接的なデータ""ベース操作と考えられます。 結果として、SQLの <literal>INSERT, UPDATE, ""DELETE</literal> がそれぞれ即座に実行されます。 このように、これらは ""<literal>Session</literal> インターフェイスで定義されている <literal>save(), ""saveOrUpdate(), delete()</literal> とは非常に異なる意味を持ちます。"#. Tag: title#: batch.xml:110#, no-c-formatmsgid "DML-style operations"msgstr "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 """すでに議論したように、自動的かつ透過的なオブジェクト/リレーショナルマッピング""は、 オブジェクトの状態の管理であると考えられます。 これはメモリ内のオブジェ""クトの状態を利用できるということです。 そのため(SQLの <literal>データ操作言""語</literal> (DML) 文: <literal>INSERT</literal>, <literal>UPDATE</""literal>, <literal>DELETE</literal> を使って)データベース内のデータを直接操""作しても、 メモリ内の状態には影響を与えません。 しかしHibernateは、バルクSQL""スタイルのDML文実行に対応するメソッドを用意しています。 これはHibernateクエリ""言語(<xref linkend=\"queryhql\">HQL</xref>) を通して実行されます。"#. Tag: para#: batch.xml:122#, no-c-format
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -