如果我用sessionbean的话是不是要将CURD都写到这里。
解决方案 »
- springMVC 页面跳转问题
- JSP如何判断一个请求是否已结束呢?
- RedHat 5(32位) 安装 Oracle Application Server 10g
- hibernate annotation配置文件简单问题...
- 求Java实现rtmp协议的基本代码
- 请hibernnate中,单表数据保存
- 能用通俗的话解释下spring吗
- 在eclipse中编译一个web工程已经导入的servlet包却报错说没有找到
- 为什么我这样利用FileWriter,在output.txt中却什么都没有显示呢?
- Java里面如何画出公司组织结构图?
- 有人推荐下比较好用的生成JSON的工具吗?
- tomcat启动问题
public void save(TCriterion transientInstance) {
log.debug("saving TCriterion instance");
try {
getSession().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(TCriterion persistentInstance) {
log.debug("deleting TCriterion instance");
try {
getSession().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public TCriterion findById( java.lang.String id) {
log.debug("getting TCriterion instance with id: " + id);
try {
TCriterion instance = (TCriterion) getSession()
.get("com.zte.database.data.TCriterion", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(TCriterion instance) {
log.debug("finding TCriterion instance by example");
try {
List results = getSession()
.createCriteria("com.zte.database.data.TCriterion")
.add(Example.create(instance))
.list();
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 TCriterion instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from TCriterion as model where model."
+ propertyName + " = " + value ;
Query queryObject = getSession().createQuery(queryString);
//queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
} public TCriterion merge(TCriterion detachedInstance) {
log.debug("merging TCriterion instance");
try {
TCriterion result = (TCriterion) getSession()
.merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
} public void attachDirty(TCriterion instance) {
log.debug("attaching dirty TCriterion instance");
try {
getSession().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(TCriterion instance) {
log.debug("attaching clean TCriterion instance");
try {
getSession().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
能结合myeclipse 讲的具体些 马 ?
谢谢 ! 线上等 !