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

📄 batch.po

📁 hibernate-distribution-3.3.1.GA-dist.zip源码
💻 PO
📖 第 1 页 / 共 2 页
字号:
msgid ""msgstr """Project-Id-Version: PACKAGE VERSION\n""Report-Msgid-Bugs-To: http://bugs.kde.org\n""POT-Creation-Date: 2008-08-14 15:28+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:29#, no-c-formatmsgid "Batch processing"msgstr "Traitement par paquet"#. Tag: para#: batch.xml:31#, no-c-formatmsgid """A naive approach to inserting 100 000 rows in the database using Hibernate ""might look like this:"msgstr """Une approche naïve pour insérer 100 000 lignes dans la base de données en ""utilisant Hibernate pourrait ressembler à ça :"#. Tag: programlisting#: batch.xml:36#, 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:38#, 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 """Ceci devrait s'écrouler avec une <literal>OutOfMemoryException</literal> ""quelque part aux alentours de la 50 000ème ligne. C'est parce qu'Hibernate ""cache toutes les instances de <literal>Customer</literal> nouvellement ""insérées dans le cache de second niveau."#. Tag: para#: batch.xml:44#, 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 """Dans ce chapitre nous montrerons comment éviter ce problème. D'abord, ""cependant, si vous faites des traitements par batch, il est absolument ""critique que vous activiez l'utilisation ds paquet JDBC (NdT : JDBC ""batching), si vous avez l'intention d'obtenir des performances raisonnables. ""Configurez la taille du paquet JDBC avec un nombre raisonnable (disons, 10-""50) :"#. Tag: programlisting#: batch.xml:51#, no-c-formatmsgid "<![CDATA[hibernate.jdbc.batch_size 20]]>"msgstr ""#. Tag: para#: batch.xml:53#, no-c-formatmsgid """Note that Hibernate disables insert batching at the JDBC level transparently ""if you use an <literal>identiy</literal> identifier generator."msgstr """Vous pourriez aussi vouloir faire cette sorte de travail dans un traitement ""où l'interaction avec le cache de second niveau est complètement désactivé :"#. Tag: para#: batch.xml:58#, 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 "Insertions en paquet"#. Tag: programlisting#: batch.xml:63#, no-c-formatmsgid "<![CDATA[hibernate.cache.use_second_level_cache false]]>"msgstr ""#. Tag: para#: batch.xml:65#, 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 """Lorsque vous rendez des nouveaux objets persistants, vous devez ""régulièrement appeler <literal>flush()</literal> et puis <literal>clear()</""literal> sur la session, pour contrôler la taille du cache de premier niveau."#. Tag: title#: batch.xml:71#, no-c-formatmsgid "Batch inserts"msgstr "Paquet de mises à jour"#. Tag: para#: batch.xml:73#, 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 """Pour récupérer et mettre à jour des données les mêmes idées s'appliquent. En ""plus, vous avez besoin d'utiliser <literal>scroll()</literal> pour tirer ""partie des curseurs côté serveur pour les requêtes qui retournent beaucoup ""de lignes de données."#. Tag: programlisting#: batch.xml:79#, 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:84#, no-c-formatmsgid "Batch updates"msgstr "L'interface StatelessSession"#. Tag: para#: batch.xml:86#, 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 """Alternativement, Hibernate fournit une API orientée commande qui peut être ""utilisée avec des flux de données pour et en provenance de la base de ""données sous la forme d'objets détachés. Une <literal>StatelessSession</""literal> n'a pas de contexte de persistance associé et ne fournit pas ""beaucoup de sémantique de durée de vie de haut niveau. En particulier, une ""session sans état n'implémente pas de cache de premier niveau et n'interagit ""pas non plus avec un cache de seconde niveau ou un cache de requêtes. Elle ""n'implémente pas les transactions ou la vérification sale automatique (NdT : ""automatic dirty checking). Les opérations réalisées avec une session sans ""état ne sont jamais répercutées en cascade sur les instances associées. Les ""collections sont ignorées par une session sans état. Les opérations ""exécutées via une session sans état outrepasse le modèle d'événements ""d'Hibernate et les intercepteurs. Les sessions sans état sont vulnérables ""aux effets de modification des données, ceci est dû au manque de cache de ""premier niveau. Une session sans état est une abstraction bas niveau, plus ""proche de la couche JDBC sous-jacente."#. Tag: programlisting#: batch.xml:92#, 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:97#, no-c-formatmsgid "The StatelessSession interface"msgstr """Notez que dans le code de l'exemple, les intances de <literal>Customer</""literal> retournées par la requête sont immédiatement détachées. Elles ne ""sont jamais associées à un contexte de persistance."#. Tag: para#: batch.xml:98#, 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 """Les opérations <literal>insert()</literal>, <literal>update()</literal> et ""<literal>delete()</literal> définies par l'interface ""<literal>StatelessSession</literal> sont considérées comme des opérations ""d'accès direct aux lignes de la base de données, ce qui résulte en une ""exécution immédiate du SQL <literal>INSERT</literal>, <literal>UPDATE</""literal> ou <literal>DELETE</literal> respectif. De là, elles ont des ""sémantiques tres différentes des opérations <literal>save()</literal>, ""<literal>saveOrUpdate()</literal> et <literal>delete()</literal> définies ""par l'interface <literal>Session</literal>."#. Tag: programlisting#: batch.xml:113#, 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:115#, 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 "Opérations de style DML"#. Tag: para#: batch.xml:121#, 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 """Comme déjà discuté avant, le mapping objet/relationnel automatique et ""transparent est intéressé par la gestion de l'état de l'objet. Ceci implique ""que l'état de l'objet est disponible en mémoire, d'où manipuler (en ""utilisant des expressions du langage de manipulation de données - ""<literal>Data Manipulation Language</literal> (DML) - SQL) les données ""directement dans la base n'affectera pas l'état en mémoire. Pourtant, ""Hibernate fournit des méthodes pour l'exécution d'expression DML de style ""SQL lesquelles sont réalisées à travers le langage de requête d'Hibernate ""(<xref linkend=\"queryhql\">HQL</xref>)."#. Tag: title#: batch.xml:134#, no-c-formatmsgid "DML-style operations"msgstr """La pseudo-syntaxe pour les expressions <literal>UPDATE</literal> et ""<literal>DELETE</literal> est : <literal>( UPDATE | DELETE ) FROM? ""EntityName (WHERE where_conditions)?</literal>. Certains points sont à ""noter :"#. Tag: para#: batch.xml:136#, 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 "Dans la clause from, le mot-clef FROM est optionnel"

⌨️ 快捷键说明

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