HHH-7813 - Fixed the mistakes in code examples. All the examples was in chapter 4 (Batch processing).

This commit is contained in:
Kamyar Sajjadi 2012-12-02 14:20:06 +01:00 committed by brmeyer
parent 48afb82ea1
commit e204ac79db
4 changed files with 8 additions and 8 deletions

View File

@ -3,9 +3,9 @@ Transaction tx = session.beginTransaction();
String hqlUpdate = "update Customer c set c.name = :newName where c.name = :oldName";
// or String hqlUpdate = "update Customer set name = :newName where name = :oldName";
int updatedEntities = s.createQuery( hqlUpdate )
int updatedEntities = session.createQuery( hqlUpdate )
.setString( "newName", newName )
.setString( "oldName", oldName )
.executeUpdate();
tx.commit();
session.close();
session.close();

View File

@ -2,7 +2,7 @@ Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
String hqlInsert = "insert into DelinquentAccount (id, name) select c.id, c.name from Customer c where ...";
int createdEntities = s.createQuery( hqlInsert )
int createdEntities = session.createQuery( hqlInsert )
.executeUpdate();
tx.commit();
session.close();
session.close();

View File

@ -3,8 +3,8 @@ Transaction tx = session.beginTransaction();
String hqlDelete = "delete Customer c where c.name = :oldName";
// or String hqlDelete = "delete Customer where name = :oldName";
int deletedEntities = s.createQuery( hqlDelete )
int deletedEntities = session.createQuery( hqlDelete )
.setString( "oldName", oldName )
.executeUpdate();
tx.commit();
session.close();
session.close();

View File

@ -1,9 +1,9 @@
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
String hqlVersionedUpdate = "update versioned Customer set name = :newName where name = :oldName";
int updatedEntities = s.createQuery( hqlUpdate )
int updatedEntities = session.createQuery( hqlUpdate )
.setString( "newName", newName )
.setString( "oldName", oldName )
.executeUpdate();
tx.commit();
session.close();
session.close();