src/com/dao/CommonDAO.java
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.dao;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
/**
* A data access object (DAO) providing persistence and search support for Txl
* entities. Transaction control of the save(), update() and delete() operations
* can directly support Spring container-managed transactions or they can be
* augmented to handle user-managed Spring transactions. Each of these methods
* provides additional information for how to configure it for the desired type
* of transaction control.
*
* @see com.cz.entity.Txl
* @author MyEclipse Persistence Tools
*/
public class CommonDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(CommonDAO.class);
protected void initDao() {
// do nothing
}
public void save(Object transientInstance) {
try {
getHibernateTemplate().save(transientInstance);
} catch (RuntimeException re) {
throw re;
}
}
public void delete(Object persistentInstance) {
try {
getHibernateTemplate().delete(persistentInstance);
} catch (RuntimeException re) {
throw re;
}
}
public Object findById(int id,String entity) {
try {
Object instance = getHibernateTemplate().get("com.model."+entity, id);
return instance;
} catch (RuntimeException re) {
throw re;
}
}
public Object findById(String id,String entity) {
try {
后面还有 76 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。