/*
* Copyright 2010 The Ganshane Team.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package corner.orm.hibernate;
import java.util.List;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.transaction.annotation.Transactional;
/**
* 针对hibernate特别支持的服务
* @author <a href="mailto:jun.tsai@gmail.com">Jun Tsai</a>
* @version $Revision$
* @since 3.1
*/
public interface HibernateEntityService {
/**
* @param queryString
* @param value
* @return
* @throws DataAccessException
* @see org.springframework.orm.hibernate3.HibernateTemplate#bulkUpdate(java.lang.String, java.lang.Object)
*/
@Transactional
public int bulkUpdate(String queryString, Object value)
throws DataAccessException;
/**
* @param queryString
* @param values
* @return
* @throws DataAccessException
* @see org.springframework.orm.hibernate3.HibernateTemplate#bulkUpdate(java.lang.String, java.lang.Object[])
*/
@Transactional
public int bulkUpdate(String queryString, Object[] values)
throws DataAccessException;
/**
* @param queryString
* @return
* @throws DataAccessException
* @see org.springframework.orm.hibernate3.HibernateTemplate#bulkUpdate(java.lang.String)
*/
@Transactional
public int bulkUpdate(String queryString) throws DataAccessException;
/**
* 保存或者更新操作
* @param entity 实体对象
* @throws DataAccessException
* @since 3.1
*/
@Transactional
public void saveOrUpdate(Object entity) throws DataAccessException;
/**
* @param action
* @return
* @throws DataAccessException
* @see org.springframework.orm.hibernate3.HibernateTemplate#executeFind(org.springframework.orm.hibernate3.HibernateCallback)
*/
public List executeFind(HibernateCallback action) throws DataAccessException;
/**
* 从缓存中把对象移走
* @param entity
* @since 3.1
*/
public void evict(Object entity);
public Object execute(HibernateCallback hibernateCallback);
}