You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
831 B
34 lines
831 B
6 years ago
|
package core.dao;
|
||
7 years ago
|
|
||
6 years ago
|
import db.model.AbstractModel;
|
||
6 years ago
|
import org.hibernate.SessionFactory;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
7 years ago
|
import org.springframework.dao.DataAccessException;
|
||
|
import org.springframework.orm.hibernate5.HibernateTemplate;
|
||
|
import org.springframework.stereotype.Repository;
|
||
6 years ago
|
import org.springframework.transaction.annotation.Transactional;
|
||
7 years ago
|
|
||
|
import java.io.Serializable;
|
||
|
|
||
|
/**
|
||
|
* Created by reborn on 2017/7/31.
|
||
|
*/
|
||
6 years ago
|
|
||
7 years ago
|
@Repository
|
||
6 years ago
|
public class BaseDao1 extends HibernateTemplate{
|
||
7 years ago
|
|
||
6 years ago
|
@Autowired
|
||
6 years ago
|
public BaseDao1(SessionFactory aliyun) {
|
||
|
super(aliyun);
|
||
7 years ago
|
}
|
||
|
|
||
6 years ago
|
public <T extends AbstractModel> void delete(Class<T> tClass, Serializable key) throws DataAccessException {
|
||
|
T model = load(tClass, key);
|
||
7 years ago
|
if (model != null) {
|
||
6 years ago
|
delete(model);
|
||
7 years ago
|
}
|
||
|
}
|
||
6 years ago
|
|
||
|
|
||
7 years ago
|
}
|