永发信息网

findByName 这个程序怎么写,在jsp上怎么,调用

答案:2  悬赏:60  手机版
解决时间 2021-03-17 17:38
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方法要实现什么功能?
全部回答
find / -name "*.java" -o -name "*.xml"
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
正月里可以把不要的东西给人吗
PL2303的晶振只能选择12M的吗?不可以选择11.
V1VO51收音机怎么找
诚信种子行地址在哪,我要去那里办事
买的2017年的社保7百多的那种,每个月单位和
三星G818E 救世主One 怎么得三星
为什么每次握拳伸开时中指那根手指伸不开,好
头发什么似的散落在肩后
如果龙鱼有内寄怎么处理
五羊本田净原系列电动车属不属于超标车
昨天晚上梦见跟女生香吻这是什么意思?我是单
改变一生的闪念(20分)那是一个老师告诉我的
梦幻西游怎么能更快的抓到带高级法爆的长眉灵
绵羊油润护精华油可以防止妊辰纹吗
什么情况可以一次性提足折旧
推荐资讯
右边助骨下有一个硬骨圆圆的正常吗
元彪有多少钱
刚拆封的新手机为何没电量开不了机
世嘉d c上有款游戏是叫空之轨迹的吗
西安火馅山烤肉炉咋样
农家自用四人化粪池长宽高是多少合适?最好请
matlab 一个数组中有多少个1
设函数f(x)有界,g(x)无界,讨论f(x) g(x)的有
求一个if函数与countif函数的套用方法
敦煌市国土局莫高国土所在什么地方啊,我要过
海马s51.5t油箱容量多少升
汕尾市城区哪里有卖仓鼠的
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?