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

📄 transactions.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 5 页
字号:
"<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 """Dans un EJB CMT même le rollback intervient automatiquement, puisqu'une ""<literal>RuntimeException</literal> non traitée et soulevée par une méthode ""d'un bean session indique au conteneur d'annuler la transaction globale. ""<emphasis>Ceci veut donc dire que vous n'avez pas à utiliser l'API ""<literal>Transaction</literal> d'Hibernate dans CMT.</emphasis>"#. Tag: para#: transactions.xml:523#, fuzzy, 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 ""compatibility), or set to <literal>\"jta\"</literal>."msgstr """Notez que le fichier de configuration Hibernate devrait contenir les valeurs ""<literal>org.hibernate.transaction.JTATransactionFactory</literal> dans un ""environnement BMT ou <literal>org.hibernate.transaction.""CMTTransactionFactory</literal> dans un environnement CMT là où vous ""configurez votre transaction factory Hibernate. N'oubliez pas non plus de ""spécifier le paramètre <literal>org.hibernate.transaction.""manager_lookup_class</literal> . De plus, assurez vous de fixez votre ""<literal>hibernate.current_session_context_class</literal> soit à <literal>""\"jta\"</literal> ou de ne pas le configurer (compatibilité avec les ""versions précédentes)."#. Tag: para#: transactions.xml:532#, fuzzy, 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> explicitly ""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 """La méthode <literal>getCurrentSession()</literal> a un inconvénient dans les ""environnement JTA. Il y a une astuce qui est d'utiliser un mode de ""libération de connexion <literal>after_statement</literal> , qui est alors ""utilisé par défaut. Du à une étrange limitation de la spec JTA, il n'est pas ""possible pour Hibernate de nettoyer et ferme automatiquement un ""<literal>ScrollableResults</literal> ouvert ou une instance ""d'<literal>Iterator</literal> retournés <literal>scroll()</literal> ou ""<literal>iterate()</literal>. Vous <emphasis>devez</emphasis> libérer le ""curseur base de données sous jacent ou invoquer <literal>Hibernate.close""(Iterator)</literal> explicitement depuis un bloc <literal>finally</""literal>. (Bien sur, la plupart des applications peuvent éviter d'uiliser ""<literal>scroll()</literal> ou <literal>iterate()</literal> dans un code ""CMT.)"#. Tag: title#: transactions.xml:548#, no-c-formatmsgid "Exception handling"msgstr "Gestion des exceptions"#. Tag: para#: transactions.xml:550#, 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 """Si une <literal>Session</literal> lance une exception (incluant les ""exceptions du type <literal>SQLException</literal> ou d'un sous-type), vous ""devez immédiatement faire le rollback de la transaction, appeler ""<literal>Session.close()</literal> et relâcher les références sur l'objet ""<literal>Session</literal> . La <literal>Session</literal> contient des ""méthodes pouvant la mettre dans un état inutilisable. Vous devez considérer ""qu'<emphasis>aucune</emphasis> exception lancée par Hibernate n'est ""traitable. Assurez-vous de fermer la session en faisant l'appel à ""<literal>close()</literal> dans un bloc <literal>finally</literal> ."#. Tag: para#: transactions.xml:561#, 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 """L'exception <literal>HibernateException</literal> , qui englobe la plupart ""des exceptions pouvant survenir dans la couche de persistance Hibernate, est ""une exception non vérifiée (Ceci n'était pas le cas dans certaines versions ""antérieures de Hibernate.) Il est de notre avis que nous ne devrions pas ""forcer un développeur à gérer une exception qu'il ne peut de toute façon pas ""traiter dans une couche technique. Dans la plupart des applications, les ""exceptions non vérifiées et les exceptions fatales sont gérées en amont du ""processus (dans les couches hautes) et un message d'erreur est alors affiché ""à l'usager (ou un traitement alternatif est invoqué.) Veuillez noter ""qu'Hibernate peut également lancer des exceptions non vérifiées d'un autre ""type que <literal>HibernateException</literal> . Celles-ci sont également ""non traitables et vous devez les traiter comme telles."#. Tag: para#: transactions.xml:573#, fuzzy, 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 exception into a more meaningful 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 englobe les <literal>SQLException</literal> s lancées lors des ""interactions directes avec la base de données dans des exceptions de type: ""<literal>JDBCException</literal> . En fait, Hibernate essaiera de convertir ""l'exception dans un sous-type plus significatif de <literal>JDBCException</""literal> . L'exception <literal>SQLException</literal> sous-jacente est ""toujours disponible via la méthode <literal>JDBCException.getCause()</""literal> . Cette conversion est faite par un objet de type ""<literal>SQLExceptionConverter</literal> , qui est rattaché à l'objet ""<literal>SessionFactory</literal> . Par défaut, le ""<literal>SQLExceptionConverter</literal> est associé au dialecte de BD ""configuré dans Hibernate. Toutefois, il est possible de fournir sa propre ""implémentation de l'interface. (Veuillez vous référer à la javadoc sur la ""classe <literal>SQLExceptionConverterFactory</literal> pour plus de détails. ""Les sous-types standard de <literal>JDBCException</literal> sont:"#. Tag: para#: transactions.xml:589#, no-c-formatmsgid """<literal>JDBCConnectionException</literal> - indicates an error with the ""underlying JDBC communication."msgstr """<literal>JDBCConnectionException</literal> - Indique une erreur de ""communication avec la couche JDBC sous-jacente."#. Tag: para#: transactions.xml:595#, no-c-formatmsgid """<literal>SQLGrammarException</literal> - indicates a grammar or syntax ""problem with the issued SQL."msgstr """<literal>SQLGrammarException</literal> - Indique un problème de grammaire ou ""de syntaxe avec la requête SQL envoyée."#. Tag: para#: transactions.xml:601#, no-c-formatmsgid """<literal>ConstraintViolationException</literal> - indicates some form of ""integrity constraint violation."msgstr """<literal>ConstraintViolationException</literal> - Indique une violation de ""contrainte d'intégrité."#. Tag: para#: transactions.xml:607#, no-c-formatmsgid """<literal>LockAcquisitionException</literal> - indicates an error acquiring a ""lock level necessary to perform the requested operation."msgstr """<literal>LockAcquisitionException</literal> - Indique une erreur de ""verrouillage lors de l'éxécution de la requête."#. Tag: para#: transactions.xml:613#, no-c-formatmsgid """<literal>GenericJDBCException</literal> - a generic exception which did not ""fall into any of the other categories."msgstr """<literal>GenericJDBCException</literal> - Indique une erreur générique JDBC ""d'une autre catégorie."#. Tag: title#: transactions.xml:623#, no-c-formatmsgid "Transaction timeout"msgstr "Timeout de transaction"#. Tag: para#: transactions.xml:625#, fuzzy, no-c-formatmsgid """One extremely important feature provided by a managed environment like EJB ""that is never provided for non-managed code is transaction timeout. ""Transaction timeouts ensure that no misbehaving transaction can indefinitely ""tie up resources while returning no response to the user. Outside a managed ""(JTA) environment, Hibernate cannot fully provide this functionality. ""However, Hibernate can at least control data access operations, ensuring ""that database level deadlocks and queries with huge result sets are limited ""by a defined timeout. In a managed environment, Hibernate can delegate ""transaction timeout to JTA. This functionality is abstracted by the ""Hibernate <literal>Transaction</literal> object."msgstr """L'un des avantages fournis par les environnements transactionnels JTA (tels ""les containers EJB) est la gestion du timeout de transaction. La gestion des ""dépassements de temps de transaction vise à s'assurer qu'une transaction ""agissant incorrectement ne viendra pas bloquer indéfiniment les ressources ""de l'application. Hibernate ne peut fournir cette fonctionnalité dans un ""environnement transactionnel non-JTA. Par contre, Hibernate gère les ""opérations d'accès aux données en allouant un temps maximal aux requêtes ""pour s'exécuter. Ainsi, une requête créant de l'inter blocage ou retournant ""de très grandes quantités d'information pourrait être interrompue. Dans un ""environnement transactionnel JTA, Hibernate peut déléguer au gestionnaire de ""transaction le soin de gérer les dépassements de temps. Cette fonctionnalité ""est abstraite par l'objet <literal>Transaction</literal> ."#. Tag: programlisting#: transactions.xml:638#, no-c-formatmsgid """<![CDATA[\n""Session sess = factory.openSession();\n""try {\n""    //set transaction timeout to 3 seconds\n""    sess.getTransaction().setTimeout(3);\n""    sess.getTransaction().begin();\n""\n""    // do some work\n""    ...\n""\n""    sess.getTransaction().commit()\n""}\n""catch (RuntimeException e) {\n""    sess.getTransaction().rollback();\n""    throw e; // or display error message\n""}\n""finally {\n""    sess.close();\n""}]]>"msgstr ""#. Tag: para#: transactions.xml:640#, no-c-formatmsgid """Note th

⌨️ 快捷键说明

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