服务端/course_mgmt/src/com/common/dao/impl/BaseDAO.java
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.common.dao.impl;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.util.Assert;
public class BaseDAO extends HibernateDaoSupport {
public static final Log log = LogFactory.getLog(BaseDAO.class);
/**
* 保存实体
*
* @param entity
*/
public boolean save(Object entity) {
try {
this.getHibernateTemplate().save(entity);
} catch (Exception e) {
e.printStackTrace();
log.info("save " + entity.getClass().getName() + " is failed!");
return false;
}
return true;
}
/**
* 保存或更新某个实例
*
* @param entity
*/
public boolean saveOrUpdate(Object entity) {
try {
this.getHibernateTemplate().saveOrUpdate(entity);
} catch (Exception e) {
e.printStackTrace();
log.info("saveOrUpdate " + entity.getClass().getName()
+ " is failed!");
return false;
}
return true;
}
/**
* Merge某个实例
*
* @param entity
后面还有 411 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。