📄 transactions.po
字号:
" throw e; // or display error message\n""}\n""finally {\n"" sess.close();\n""}]]>"msgstr ""#. Tag: para#: transactions.xml:476#, no-c-formatmsgid """If you want to use a transaction-bound <literal>Session</literal>, that is, ""the <literal>getCurrentSession()</literal> functionality for easy context ""propagation, you will have to use the JTA <literal>UserTransaction</literal> ""API directly:"msgstr """トランザクション境界として <literal>Session</literal> を使いたい場合、 簡単に""コンテキストを伝播する機能である <literal>getCurrentSession()</literal> があ""るので、 JTAの <literal>UserTransaction</literal> APIを直接使用すべきでしょ""う。"#. Tag: programlisting#: transactions.xml:482#, no-c-formatmsgid """<![CDATA[// BMT idiom with getCurrentSession()\n""try {\n"" UserTransaction tx = (UserTransaction)new InitialContext()\n"" .lookup(\"java:comp/UserTransaction\");\n""\n"" tx.begin();\n""\n"" // Do some work on Session bound to transaction\n"" factory.getCurrentSession().load(...);\n"" factory.getCurrentSession().persist(...);\n""\n"" tx.commit();\n""}\n""catch (RuntimeException e) {\n"" tx.rollback();\n"" throw e; // or display error message\n""}]]>"msgstr ""#. Tag: para#: transactions.xml:484#, no-c-formatmsgid """With CMT, transaction demarcation is done in session bean deployment ""descriptors, not programatically, hence, the code is reduced to:"msgstr """CMTでは、トランザクション境界をセッションBeanのデプロイメントディスクリプタで""定義し、 プログラムでは行いません。 ゆえに、コードは次のように少なくなりま""す。"#. Tag: programlisting#: transactions.xml:489#, no-c-formatmsgid """<![CDATA[// CMT idiom\n"" Session sess = factory.getCurrentSession();\n""\n"" // do some work\n"" ...\n""]]>"msgstr ""#. Tag: para#: transactions.xml:491#, no-c-formatmsgid """In a CMT/EJB even rollback happens automatically, since an unhandled ""<literal>RuntimeException</literal> thrown by a session bean method tells ""the container to set the global transaction to rollback. <emphasis>This ""means you do not need to use the Hibernate <literal>Transaction</literal> ""API at all with BMT or CMT, and you get automatic propagation of the ""\"current\" Session bound to the transaction.</emphasis>"msgstr """CMT/EJBの中では、常にロールバックが自動的に実施されます。 なぜなら、セッショ""ンビーンのメソッドにより投げられた制御されていない ""<literal>RuntimeException</literal> は、グローバルトランザクションを ロール""バックするようにコンテナに伝えるためです。 <emphasis>これは、BMTもしくはCMTと""いっしょにHibernate <literal>Transaction</literal> APIを使う必要は少しもない""という意味です。</emphasis>"#. Tag: para#: transactions.xml:499#, no-c-formatmsgid """Note that you should choose <literal>org.hibernate.transaction.""JTATransactionFactory</literal> if you use JTA directly (BMT), and ""<literal>org.hibernate.transaction.CMTTransactionFactory</literal> in a CMT ""session bean, when you configure Hibernate's transaction factory. Remember ""to also set <literal>hibernate.transaction.manager_lookup_class</literal>. ""Furthermore, make sure that your <literal>hibernate.""current_session_context_class</literal> is either unset (backwards ""compatiblity), or set to <literal>\"jta\"</literal>."msgstr """Hibernateのトランザクションファクトリを設定する際に、 JTAを直接使う(BMTの)""場合は <literal>org.hibernate.transaction.JTATransactionFactory</literal> ""を、 CMTセッションビーンの中では <literal>org.hibernate.transaction.""CMTTransactionFactory</literal> を 選択すべきだということに注意してくださ""い。 <literal>hibernate.transaction.manager_lookup_class</literal> をセットす""ることも思い出してください。 なお、<literal>hibernate.""current_session_context_class</literal> は、 セットしないか(後方互換)、""<literal>\"jta\"</literal> をセットしてください。"#. Tag: para#: transactions.xml:508#, no-c-formatmsgid """The <literal>getCurrentSession()</literal> operation has one downside in a ""JTA environment. There is one caveat to the use of <literal>after_statement</""literal> connection release mode, which is then used by default. Due to a ""silly limitation of the JTA spec, it is not possible for Hibernate to ""automatically clean up any unclosed <literal>ScrollableResults</literal> or ""<literal>Iterator</literal> instances returned by <literal>scroll()</""literal> or <literal>iterate()</literal>. You <emphasis>must</emphasis> ""release the underlying database cursor by calling <literal>ScrollableResults.""close()</literal> or <literal>Hibernate.close(Iterator)</literal> explicity ""from a <literal>finally</literal> block. (Of course, most applications can ""easily avoid using <literal>scroll()</literal> or <literal>iterate()</""literal> at all from the JTA or CMT code.)"msgstr """<literal>getCurrentSession()</literal> オペレーションは、JTA環境では1つの欠""点を持ちます。 デフォルトで使われる <literal>after_statement</literal> コネク""ションリリースモードを使用する上で、 警告が1つあります。 JTA仕様の愚かな制約""のために、 <literal>scroll()</literal> または <literal>iterate()</literal> が""返した、 閉じられていない <literal>ScrollableResults</literal> または ""<literal>Iterator</literal> インスタンスをHibernateが自動的にクリーンアップす""ることはできません。 <literal>finally</literal> ブロックの中で、 ""<literal>ScrollableResults.close()</literal> または <literal>Hibernate.close""(Iterator)</literal> を明示的に呼び出して、 裏に潜んだデータベースカーソルを""解放 <emphasis>しなければなりません</emphasis>。 (もちろん、多くのアプリケー""ションでは、JTAかCMTコードで <literal>scroll()</literal> や <literal>iterate""()</literal> の使用を避けるのは容易です。)"#. Tag: title#: transactions.xml:524#, no-c-formatmsgid "Exception handling"msgstr "例外ハンドリング"#. Tag: para#: transactions.xml:526#, no-c-formatmsgid """If the <literal>Session</literal> throws an exception (including any ""<literal>SQLException</literal>), you should immediately rollback the ""database transaction, call <literal>Session.close()</literal> and discard ""the <literal>Session</literal> instance. Certain methods of ""<literal>Session</literal> will <emphasis>not</emphasis> leave the session ""in a consistent state. No exception thrown by Hibernate can be treated as ""recoverable. Ensure that the <literal>Session</literal> will be closed by ""calling <literal>close()</literal> in a <literal>finally</literal> block."msgstr """<literal>Session</literal> が例外(<literal>SQLException</literal>を含む)を""投げた場合、 直ちに、データベーストランザクションをロールバックし、""<literal>Session.close()</literal> を呼び、<literal>Session</literal> インス""タンスを破棄すべきです。 <literal>Session</literal> のいくつかのメソッドは、 ""セッションの状態を <emphasis>矛盾したまま</emphasis> にします。 Hibernateが投""げた例外を、回復できるものとして扱うことはできません。 <literal>finally</""literal> ブロックの中で <literal>close()</literal> を呼んで、 ""<literal>Session</literal> を確実に閉じてください。"#. Tag: para#: transactions.xml:537#, no-c-formatmsgid """The <literal>HibernateException</literal>, which wraps most of the errors ""that can occur in a Hibernate persistence layer, is an unchecked exception ""(it wasn't in older versions of Hibernate). In our opinion, we shouldn't ""force the application developer to catch an unrecoverable exception at a low ""layer. In most systems, unchecked and fatal exceptions are handled in one of ""the first frames of the method call stack (i.e. in higher layers) and an ""error message is presented to the application user (or some other ""appropriate action is taken). Note that Hibernate might also throw other ""unchecked exceptions which are not a <literal>HibernateException</literal>. ""These are, again, not recoverable and appropriate action should be taken."msgstr """<literal>HibernateException</literal> は、Hibernate永続化層の中で発生する多く""のエラーを ラップする、検査されない例外です(Hibernateの古いバージョンは違い""ました)。 私たちの意見は、アプリケーション開発者に回復不可能な例外を 下層で""キャッチすることを強要すべきではないということです。 多くのシステムでは、検査""されない例外と致命的な例外は、 コールスタックの最初のフレームの1つ(例えば、""最上位の層で)でハンドリングし、 エラーメッセージをアプリケーションユーザーに""表示します (もしくは、他の適切な処理を実施します)。 Hibernateは、""<literal>HibernateException</literal> 以外の検査されない例外も 投げることに注""意してください。 これらもまた、回復不可能であり、適切な処理を実施すべきです。"#. Tag: para#: transactions.xml:549#, no-c-formatmsgid """Hibernate wraps <literal>SQLException</literal>s thrown while interacting ""with the database in a <literal>JDBCException</literal>. In fact, Hibernate ""will attempt to convert the eexception into a more meningful subclass of ""<literal>JDBCException</literal>. The underlying <literal>SQLException</""literal> is always available via <literal>JDBCException.getCause()</""literal>. Hibernate converts the <literal>SQLException</literal> into an ""appropriate <literal>JDBCException</literal> subclass using the ""<literal>SQLExceptionConverter</literal> attached to the ""<literal>SessionFactory</literal>. By default, the ""<literal>SQLExceptionConverter</literal> is defined by the configured ""dialect; however, it is also possible to plug in a custom implementation ""(see the javadocs for the <literal>SQLExceptionConverterFactory</literal> ""class for details). The standard <literal>JDBCException</literal> subtypes ""are:"msgstr """Hibernateは、データベースとの対話中に投げられた <literal>SQLException</""literal> を <literal>JDBCException</literal> でラップします。 実は、例外をよ""り意味のある <literal>JDBCException</literal> のサブクラスに 変換しようと試み""ます。 元の <literal>SQLException</literal> は、<literal>JDBCException.""getCause()</literal> によりいつでも得られます。 Hibernateは、""<literal>SessionFactory</literal> に追加されている ""<literal>SQLExceptionConverter</literal> を使い、<literal>SQLException</""literal> を 適当な <literal>JDBCException</literal> サブクラスに変換します。 ""デフォルトでは、<literal>SQLExceptionConverter</literal> は設定されているSQL""方言により 定義されます。 一方で、独自の実装に差し替えることもできます (詳細""は、<literal>SQLExceptionConverterFactory</literal> クラスのJavadocを参照して""ください)。 標準的な <literal>JDBCException</literal> のサブタイプを下記に示""します。"#. Tag: para#: transactions.xml:565#, no-c-formatmsgid """<literal>JDBCConnectionException</literal> - indicates an error with the ""underlying JDBC communication."msgstr """<literal>JDBCConnectionException</literal> - 基礎となるJDBC通信のエラーを表し""ます。"#. Tag: para#: transactions.xml:571#, no-c-formatmsgid """<literal>SQLGrammarException</literal> - indicates a grammar or syntax ""problem with the issued SQL."msgst
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -