All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yuweix.kuafu.dao.hibernate.IndexModifyCallback Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.yuweix.kuafu.dao.hibernate;


import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.query.NativeQuery;


/**
 * @author yuwei
 */
public class IndexModifyCallback extends AbstractIntegerCallback {
	protected String sql;
	protected Object[] params;

	public IndexModifyCallback(String sql, Object[] params) {
		this.sql = sql;
		this.params = params;
	}

	@Override
	public Integer doInHibernate(Session session) throws HibernateException {
		NativeQuery query = session.createNativeQuery(sql, Integer.class);
		assembleParams(query, params);
		return query.executeUpdate();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy