package com.uestc.dao;
import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.uestc.model.*;;
public class ListMessageDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(ListMessageDAO.class);
// property constants
public static final String TEXT = "text";
public static final String REBACK = "reback";
public static final String NAME = "name";
protected void initDao() {
// do nothing
}
public ListMessage findById(java.lang.Integer id) {
log.debug("getting ListMessage instance with id: " + id);
try {
ListMessage instance = (ListMessage) getHibernateTemplate().get(
"com.uestc.model.ListMessage", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(ListMessage instance) {
log.debug("finding ListMessage instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding ListMessage instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from ListMessage as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByText(Object text) {
return findByProperty(TEXT, text);
}
public List findByReback(Object reback) {
return findByProperty(REBACK, reback);
}
public List findByName(Object name) {
return findByProperty(NAME, name);
}
我刚学这些,还不知道怎么用,这些代码是自动生成的,
通过name这个属性,在数据库中查找该属性!
findByName 这个程序怎么写,在jsp上怎么,调用
答案:2 悬赏:60 手机版
解决时间 2021-03-17 17:38
- 提问者网友:末路
- 2021-03-16 18:53
最佳答案
- 五星知识达人网友:动情书生
- 2021-03-16 19:06
没搞懂你想要什么?你把业务说一下,findByName方法要实现什么功能?
全部回答
- 1楼网友:低音帝王
- 2021-03-16 20:39
find / -name "*.java" -o -name "*.xml"
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯