Hello I see in the documentation that exits the method query.executeUpdate , but I don't find in Hibernate 2.2 in the example
As an example, to execute an HQL UPDATE, use the Query.executeUpdate() method The method is named for those familiar with JDBC's PreparedStatement.executeUpdate():
Session session = sessionFactory.openSession(); 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 ) .setString( "newName", newName ) .setString( "oldName", oldName ) .executeUpdate(); tx.commit(); session.close();
y try to do in c# hibernate 2.2
public void SetMainPhoto() { ISession session = this._sessionManager.OpenSession();
String hql = "update cm_photorotation set mainfoto = :mainfoto where sectionid = :sectionid"; IQuery query = session.CreateQuery(hql); query.SetBoolean("mainfoto", false); query.SetInt32("sectionid",base.Section.Id); } don´t exist query.executeUpdate() ,
¿ exist another method similar ? many thanks and sorry for my english
|