alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (batch.po)

This example Hibernate source code file (batch.po) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

cdata, customer, customer, hibernate, hibernate, hql, hql, jdbc, sql, string, tag, tag, the, transaction

The Hibernate batch.po source code

# translation of Collection_Mapping.po to
# Xi Huang <xhuang@redhat.com>, 2006.
# Xi HUANG <xhuang@redhat.com>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: Collection_Mapping\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2010-02-11T05:38:15\n"
"PO-Revision-Date: 2010-03-15 08:58+1000\n"
"Last-Translator: Xi HUANG <xhuang@redhat.com>\n"
"Language-Team:  <en@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"

#. Tag: title
#, no-c-format
msgid "Batch processing"
msgstr "批量处理(Batch processing)"

#. Tag: para
#, no-c-format
msgid "A naive approach to inserting 100,000 rows in the database using Hibernate might look like this:"
msgstr "使用 Hibernate 将 100,000 条记录插入到数据库的一个很天真的做法可能是这样的:"

#. Tag: para
#, no-c-format
msgid "This would fall over with an <literal>OutOfMemoryException somewhere around the 50,000th row. That is because Hibernate caches all the newly inserted Customer instances in the session-level cache. In this chapter we will show you how to avoid this problem."
msgstr "这段程序大概运行到 50,000 条记录左右会失败并抛出<literal>内存溢出异常(OutOfMemoryException) 。这是因为 Hibernate 把所有新插入的客户(Customer)实例在 session 级别的缓存区进行了缓存的缘故。 "

#. Tag: para
#, no-c-format
msgid "If you are undertaking batch processing you will need to enable the use of JDBC batching. This is absolutely essential if you want to achieve optimal performance. Set the JDBC batch size to a reasonable number (10-50, for example):"
msgstr "我们会在本章告诉你如何避免此类问题。首先,如果你要执行批量处理并且想要达到一个理想的性能,那么使用 JDBC 的批量(batching)功能是至关重要。将 JDBC 的批量抓取数量(batch size)参数设置到一个合适值(比如,10 - 50 之间):"

#. Tag: para
#, no-c-format
msgid "Hibernate disables insert batching at the JDBC level transparently if you use an <literal>identity identifier generator."
msgstr "注意,假若你使用了 <literal>identiy 标识符生成器,Hibernate 在 JDBC 级别透明的关闭插入语句的批量执行。 "

#. Tag: para
#, no-c-format
msgid "You can also do this kind of work in a process where interaction with the second-level cache is completely disabled:"
msgstr "你也可能想在执行批量处理时完全关闭二级缓存:"

#. Tag: para
#, no-c-format
msgid "However, this is not absolutely necessary, since we can explicitly set the <literal>CacheMode to disable interaction with the second-level cache."
msgstr "但是,这不是绝对必须的,因为我们可以显式设置 <literal>CacheMode 来关闭与二级缓存的交互。"

#. Tag: title
#, no-c-format
msgid "Batch inserts"
msgstr "批量插入(Batch inserts)"

#. Tag: para
#, no-c-format
msgid "When making new objects persistent <literal>flush() and then clear() the session regularly in order to control the size of the first-level cache."
msgstr "如果要将很多对象持久化,你必须通过经常的调用 <literal>flush() 以及稍后调用  clear() 来控制第一级缓存的大小。 "

#. Tag: title
#, no-c-format
msgid "Batch updates"
msgstr "批量更新(Batch updates)"

#. Tag: para
#, no-c-format
msgid "For retrieving and updating data, the same ideas apply. In addition, you need to use <literal>scroll() to take advantage of server-side cursors for queries that return many rows of data."
msgstr "此方法同样适用于检索和更新数据。此外,在进行会返回很多行数据的查询时,你需要使用 <literal>scroll() 方法以便充分利用服务器端游标所带来的好处。 "

#. Tag: title
#, no-c-format
msgid "The StatelessSession interface"
msgstr "StatelessSession(无状态 session)接口"

#. Tag: para
#, no-c-format
msgid "Alternatively, Hibernate provides a command-oriented API that can be used for streaming data to and from the database in the form of detached objects. A <literal>StatelessSession 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 never cascade to associated instances. Collections are ignored by a stateless session. Operations performed via a stateless session bypass Hibernate's event model and interceptors. Due to the lack of a first-level cache, Stateless sessions are vulnerable to data aliasing effects. A stateless session is a lower-level abstraction that is much closer to the underlying JDBC."
msgstr "作为选择,Hibernate 提供了基于命令的 API,可以用 detached object 的形式把数据以流的方法加入到数据库,或从数据库输出。<literal>StatelessSession 没有持久化上下文,也不提供多少高层的生命周期语义。特别是,无状态 session 不实现第一级 cache,也不和第二级缓存,或者查询缓存交互。它不实现事务化写,也不实现脏数据检查。用 stateless session 进行的操作甚至不级联到关联实例。stateless session 忽略集合类(Collections)。通过 stateless session 进行的操作不触发 Hibernate 的事件模型和拦截器。无状态 session 对数据的混淆现象免疫,因为它没有第一级缓存。无状态 session 是低层的抽象,和低层 JDBC 相当接近。 "

#. Tag: para
#, no-c-format
msgid "In this code example, the <literal>Customer instances returned by the query are immediately detached. They are never associated with any persistence context."
msgstr "注意在上面的例子中,查询返回的 <literal>Customer 实例立即被脱管(detach)。它们与任何持久化上下文都没有关系。 "

#. Tag: para
#, no-c-format
msgid "The <literal>insert(), update() and delete() operations defined by the StatelessSession interface are considered to be direct database row-level operations. They result in the immediate execution of a SQL INSERT, UPDATE or DELETE respectively. They have different semantics to the save(), saveOrUpdate() and delete() operations defined by the Session interface."
msgstr "<literal>StatelessSession 接口定义的 insert(), update()delete() 操作是直接的数据库行级别操作,其结果是立刻执行一条 INSERT, UPDATEDELETE 语句。因此,它们的语义和 Session 接口定义的 save(), saveOrUpdate()delete() 操作有很大的不同。 "

#. Tag: title
#, no-c-format
msgid "DML-style operations"
msgstr "DML(数据操作语言)风格的操作(DML-style operations)"

#. Tag: para
#, no-c-format
msgid "As already discussed, automatic and transparent object/relational mapping is concerned with the management of the object state. The object state is available in memory. This means that manipulating data directly in the database (using the SQL <literal>Data Manipulation Language (DML) the statements: INSERT, UPDATE, DELETE) will not affect in-memory state. However, Hibernate provides methods for bulk SQL-style DML statement execution that is performed through the Hibernate Query Language (HQL)."
msgstr "就像已经讨论的那样,自动和透明的对象/关系映射(object/relational mapping)关注于管理对象的状态。这就意味着对象的状态存在于内存,因此直接操作(使用 SQL <literal>Data Manipulation Language(DML,数据操作语言)语句 :INSERT ,UPDATEDELETE) 数据库中的数据将不会影响内存中的对象状态和对象数据。不过,Hibernate 提供通过 Hibernate 查询语言(HQL)来执行大批量 SQL 风格的 DML 语句的方法。 "

#. Tag: para
#, no-c-format
msgid "The pseudo-syntax for <literal>UPDATE and DELETE statements is: ( UPDATE | DELETE ) FROM? EntityName (WHERE where_conditions)?."
msgstr "<literal>UPDATE 和 DELETE 语句的伪语法为:( UPDATE | DELETE ) FROM? EntityName (WHERE where_conditions)?。"

#. Tag: para
#, no-c-format
msgid "Some points to note:"
msgstr "要注意的事项:"

#. Tag: para
#, no-c-format
msgid "In the from-clause, the FROM keyword is optional"
msgstr "在 FROM 子句(from-clause)中,FROM 关键字是可选的"

#. Tag: para
#, no-c-format
msgid "There can only be a single entity named in the from-clause. It can, however, be aliased. If the entity name is aliased, then any property references must be qualified using that alias. If the entity name is not aliased, then it is illegal for any property references to be qualified."
msgstr "在 FROM 子句(from-clause)中只能有一个实体名,它可以是别名。如果实体名是别名,那么任何被引用的属性都必须加上此别名的前缀;如果不是别名,那么任何有前缀的属性引用都是非法的。 "

#. Tag: para
#, no-c-format
msgid "No <link linkend=\"queryhql-joins-forms\">joins, either implicit or explicit, can be specified in a bulk HQL query. Sub-queries can be used in the where-clause, where the subqueries themselves may contain joins."
msgstr "不能在大批量 HQL 语句中使用 <link linkend=\"queryhql-joins-forms\">joins 连接(显式或者隐式的都不行)。不过在 WHERE 子句中可以使用子查询。可以在 where 子句中使用子查询,子查询本身可以包含 join。 "

#. Tag: para
#, no-c-format
msgid "The where-clause is also optional."
msgstr "整个 WHERE 子句是可选的。"

#. Tag: para
#, no-c-format
msgid "As an example, to execute an HQL <literal>UPDATE, use the Query.executeUpdate() method. The method is named for those familiar with JDBC's PreparedStatement.executeUpdate():"
msgstr "举个例子,使用 <literal>Query.executeUpdate() 方法执行一个 HQL UPDATE语句(方法命名是来源于 JDBC 的 PreparedStatement.executeUpdate()): "

#. Tag: para
#, no-c-format
msgid "In keeping with the EJB3 specification, HQL <literal>UPDATE statements, by default, do not effect the version or the timestamp property values for the affected entities. However, you can force Hibernate to reset the version or timestamp property values through the use of a versioned update. This is achieved by adding the VERSIONED keyword after the UPDATE keyword."
msgstr "HQL <literal>UPDATE 语句,默认不会影响更新实体的 version 或 the timestamp 属性值。这和 EJB3 规范是一致的。但是,通过使用 versioned update,你可以强制 Hibernate 正确的重置version 或者 timestamp 属性值。这通过在 UPDATE 关键字后面增加 VERSIONED 关键字来实现的。 "

#. Tag: para
#, no-c-format
msgid "Custom version types, <literal>org.hibernate.usertype.UserVersionType, are not allowed in conjunction with a update versioned statement."
msgstr "注意,自定义的版本类型(<literal>org.hibernate.usertype.UserVersionType)不允许和 update versioned 语句联用。 "

#. Tag: para
#, no-c-format
msgid "To execute an HQL <literal>DELETE, use the same Query.executeUpdate() method:"
msgstr "执行一个 HQL <literal>DELETE,同样使用 Query.executeUpdate() 方法:"

#. Tag: para
#, no-c-format
msgid "The <literal>int value returned by the Query.executeUpdate() method indicates the number of entities effected by the operation. This may or may not correlate to the number of rows effected in the database. An HQL bulk operation might result in multiple actual SQL statements being executed (for joined-subclass, for example). The returned number indicates the number of actual entities affected by the statement. Going back to the example of joined-subclass, a delete against one of the subclasses may actually result in deletes against not just the table to which that subclass is mapped, but also the \"root\" table and potentially joined-subclass tables further down the inheritance hierarchy."
msgstr "由 <literal>Query.executeUpdate() 方法返回的整型值表明了受此操作影响的记录数量。注意这个数值可能与数据库中被(最后一条 SQL 语句)影响了的“行”数有关,也可能没有。一个大批量 HQL 操作可能导致多条实际的SQL语句被执行,举个例子,对 joined-subclass 映射方式的类进行的此类操作。这个返回值代表了实际被语句影响了的记录数量。在那个 joined-subclass 的例子中, 对一个子类的删除实际上可能不仅仅会删除子类映射到的表而且会影响“根”表,还有可能影响与之有继承关系的 joined-subclass 映射方式的子类的表。 "

#. Tag: para
#, no-c-format
msgid "The pseudo-syntax for <literal>INSERT statements is: INSERT INTO EntityName properties_list select_statement. Some points to note:"
msgstr "<literal>INSERT 语句的伪码是:INSERT INTO EntityName properties_list select_statement。要注意的是:"

#. Tag: para
#, no-c-format
msgid "Only the INSERT INTO ... SELECT ... form is supported; not the INSERT INTO ... VALUES ... form."
msgstr "只支持 INSERT INTO ... SELECT ... 形式,不支持 INSERT INTO ... VALUES ... 形式。"

#. Tag: para
#, no-c-format
msgid "The properties_list is analogous to the <literal>column specification in the SQL INSERT statement. For entities involved in mapped inheritance, only properties directly defined on that given class-level can be used in the properties_list. Superclass properties are not allowed and subclass properties do not make sense. In other words, INSERT statements are inherently non-polymorphic."
msgstr "properties_list 和 SQL <literal>INSERT 语句中的字段定义(column speficiation)类似。对参与继承树映射的实体而言,只有直接定义在给定的类级别的属性才能直接在 properties_list 中使用。超类的属性不被支持;子类的属性无意义。换句话说,INSERT 天生不支持多态性。"

#. Tag: para
#, no-c-format
msgid "select_statement can be any valid HQL select query, with the caveat that the return types must match the types expected by the insert. Currently, this is checked during query compilation rather than allowing the check to relegate to the database. This might, however, cause problems between Hibernate <literal>Types which are equivalent as opposed to equal. This might cause issues with mismatches between a property defined as a org.hibernate.type.DateType and a property defined as a org.hibernate.type.TimestampType, even though the database might not make a distinction or might be able to handle the conversion."
msgstr "select_statement 可以是任何合法的 HQL 选择查询,不过要保证返回类型必须和要插入的类型完全匹配。目前,这一检查是在查询编译的时候进行的,而不是把它交给数据库。注意,在Hibernate<literal>Type 间如果只是等价(equivalent)而非相等(equal),会导致问题。定义为 org.hibernate.type.DateTypeorg.hibernate.type.TimestampType 的两个属性可能会产生类型不匹配错误,虽然数据库级可能不加区分或者可以处理这种转换。 "

#. Tag: para
#, no-c-format
msgid "For the id property, the insert statement gives you two options. You can either explicitly specify the id property in the properties_list, in which case its value is taken from the corresponding select expression, or omit it from the properties_list, in which case a generated value is used. This latter option is only available when using id generators that operate in the database; attempting to use this option with any \"in memory\" type generators will cause an exception during parsing. For the purposes of this discussion, in-database generators are considered to be <literal>org.hibernate.id.SequenceGenerator (and its subclasses) and any implementers of org.hibernate.id.PostInsertIdentifierGenerator. The most notable exception here is org.hibernate.id.TableHiLoGenerator, which cannot be used because it does not expose a selectable way to get its values."
msgstr "对 id 属性来说,insert 语句给你两个选择。你可以明确地在 properties_list 表中指定 id 属性(这样它的值是从对应的 select 表达式中获得),或者在 properties_list 中省略它(此时使用生成指)。后一种选择只有当使用在数据库中生成值的 id 产生器时才能使用;如果是“内存”中计算的类型生成器,在解析时会抛出一个异常。注意,为了说明这一问题,数据库产生值的生成器是 <literal>org.hibernate.id.SequenceGenerator(和它的子类),以及任何 org.hibernate.id.PostInsertIdentifierGenerator 接口的实现。这儿最值得注意的意外是 org.hibernate.id.TableHiLoGenerator,它不能在此使用,因为它没有得到其值的途径。 "

#. Tag: para
#, no-c-format
msgid "For properties mapped as either <literal>version or timestamp, the insert statement gives you two options. You can either specify the property in the properties_list, in which case its value is taken from the corresponding select expressions, or omit it from the properties_list, in which case the seed value defined by the org.hibernate.type.VersionType is used."
msgstr "对映射为 <literal>version 或 timestamp 的属性来说,insert 语句也给你两个选择,你可以在 properties_list 表中指定(此时其值从对应的 select 表达式中获得),或者在 properties_list 中省略它(此时,使用在 org.hibernate.type.VersionType 中定义的 seed value(种子值))。"

#. Tag: para
#, no-c-format
msgid "The following is an example of an HQL <literal>INSERT statement execution:"
msgstr "下面是一个执行 HQL <literal>INSERT 语句的例子:"

#~ msgid ""
#~ "<![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 ""
#~ "<![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();]]>"

#~ msgid "<![CDATA[hibernate.jdbc.batch_size 20]]>"
#~ msgstr "<![CDATA[hibernate.jdbc.batch_size 20]]>"

#~ msgid "<![CDATA[hibernate.cache.use_second_level_cache false]]>"
#~ msgstr "<![CDATA[hibernate.cache.use_second_level_cache false]]>"

#~ msgid ""
#~ "<![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 ""
#~ "<![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();]]>"

#~ msgid ""
#~ "<![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 ""
#~ "<![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();]]>"

#~ msgid ""
#~ "<![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 ""
#~ "<![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();]]>"

#~ msgid ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "String hqlUpdate = \"update Customer c set c.name = :newName where c.name "
#~ "= :oldName\";\n"
#~ "// or String hqlUpdate = \"update Customer set name = :newName where name "
#~ "= :oldName\";\n"
#~ "int updatedEntities = s.createQuery( hqlUpdate )\n"
#~ "        .setString( \"newName\", newName )\n"
#~ "        .setString( \"oldName\", oldName )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"
#~ msgstr ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "String hqlUpdate = \"update Customer c set c.name = :newName where c.name "
#~ "= :oldName\";\n"
#~ "// or String hqlUpdate = \"update Customer set name = :newName where name "
#~ "= :oldName\";\n"
#~ "int updatedEntities = s.createQuery( hqlUpdate )\n"
#~ "        .setString( \"newName\", newName )\n"
#~ "        .setString( \"oldName\", oldName )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"

#~ msgid ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "String hqlVersionedUpdate = \"update versioned Customer set name = :"
#~ "newName where name = :oldName\";\n"
#~ "int updatedEntities = s.createQuery( hqlUpdate )\n"
#~ "        .setString( \"newName\", newName )\n"
#~ "        .setString( \"oldName\", oldName )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"
#~ msgstr ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "String hqlVersionedUpdate = \"update versioned Customer set name = :"
#~ "newName where name = :oldName\";\n"
#~ "int updatedEntities = s.createQuery( hqlUpdate )\n"
#~ "        .setString( \"newName\", newName )\n"
#~ "        .setString( \"oldName\", oldName )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"

#~ msgid ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "String hqlDelete = \"delete Customer c where c.name = :oldName\";\n"
#~ "// or String hqlDelete = \"delete Customer where name = :oldName\";\n"
#~ "int deletedEntities = s.createQuery( hqlDelete )\n"
#~ "        .setString( \"oldName\", oldName )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"
#~ msgstr ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "String hqlDelete = \"delete Customer c where c.name = :oldName\";\n"
#~ "// or String hqlDelete = \"delete Customer where name = :oldName\";\n"
#~ "int deletedEntities = s.createQuery( hqlDelete )\n"
#~ "        .setString( \"oldName\", oldName )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"

#~ msgid ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "String hqlInsert = \"insert into DelinquentAccount (id, name) select c."
#~ "id, c.name from Customer c where ...\";\n"
#~ "int createdEntities = s.createQuery( hqlInsert )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"
#~ msgstr ""
#~ "<![CDATA[Session session = sessionFactory.openSession();\n"
#~ "Transaction tx = session.beginTransaction();\n"
#~ "\n"
#~ "String hqlInsert = \"insert into DelinquentAccount (id, name) select c."
#~ "id, c.name from Customer c where ...\";\n"
#~ "int createdEntities = s.createQuery( hqlInsert )\n"
#~ "        .executeUpdate();\n"
#~ "tx.commit();\n"
#~ "session.close();]]>"

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate batch.po source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.