Joined: Mon Jan 21, 2008 10:51 am Posts: 2
|
This is what I have coded but its not working as per my need
public void deleteTable() {
final HibernateTemplate ht = new HibernateTemplate(getSessionFactory());
ht.execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
Transaction tx = session.beginTransaction();
String hqlDelete = "Delete From TableName " ;
SQLQueryImpl queryString = (SQLQueryImpl) session.createSQLQuery(hqlDelete);
queryString.setMaxResults(100);
int noOfRecords = queryString.executeUpdate();
log.debug("No of Records deleted :" + noOfRecords);
tx.commit();
session.close();
return null;
}
});
}
|
|