在SSH环境下代码如下:
public String addUpdateNetType() throws Exception{
InfoCodeNetType icnt=new InfoCodeNetType();
icnt.setNetTypeCode(infoCodeNetTypeService.getSequenceNextVal ("INFO_CODE_NET_TYPE_SEQ").toString());
icnt.setNetTypeName(infoCodeNetType.getNetTypeName());
icnt.setNetTypeNote(infoCodeNetType.getNetTypeNote());
icnt.setNetTypeOrder(infoCodeNetType.getNetTypeOrder());
icnt.setInfoCodeNetTypeProperty(infoCodeNetType.getInfoCodeNetTypeProperty());
icnt.setInfoCodeNetTypeStatus(infoCodeNetType.getInfoCodeNetTypeStatus());
this.infoCodeNetTypeService.update(icnt);
return SUCCESS;
}
我本意是要 从JSP中获得值 通过Action中上述方法把这个对象保存到数据库,刚刚开始我是用的实体类引用
(就是把 "InfoCodeNetType icnt=new InfoCodeNetType()"去掉 icnt 换成Action中声明的实体类引用),现在我新建一个对象 也是执行查询
查询语句如下:
15:49:20,078 INFO [STDOUT] Hibernate:
update
INFO_CODE_NET_TYPE
set
NET_TYPE_PROPERTY_ID=?,
NET_TYPE_STATUS_ID=?,
NET_TYPE_NAME=?,
NET_TYPE_NOTE=?,
NET_TYPE_ORDER=?
where
NET_TYPE_CODE=?
public String addUpdateNetType() throws Exception{
InfoCodeNetType icnt=new InfoCodeNetType();
icnt.setNetTypeCode(infoCodeNetTypeService.getSequenceNextVal ("INFO_CODE_NET_TYPE_SEQ").toString());
icnt.setNetTypeName(infoCodeNetType.getNetTypeName());
icnt.setNetTypeNote(infoCodeNetType.getNetTypeNote());
icnt.setNetTypeOrder(infoCodeNetType.getNetTypeOrder());
icnt.setInfoCodeNetTypeProperty(infoCodeNetType.getInfoCodeNetTypeProperty());
icnt.setInfoCodeNetTypeStatus(infoCodeNetType.getInfoCodeNetTypeStatus());
this.infoCodeNetTypeService.update(icnt);
return SUCCESS;
}
我本意是要 从JSP中获得值 通过Action中上述方法把这个对象保存到数据库,刚刚开始我是用的实体类引用
(就是把 "InfoCodeNetType icnt=new InfoCodeNetType()"去掉 icnt 换成Action中声明的实体类引用),现在我新建一个对象 也是执行查询
查询语句如下:
15:49:20,078 INFO [STDOUT] Hibernate:
update
INFO_CODE_NET_TYPE
set
NET_TYPE_PROPERTY_ID=?,
NET_TYPE_STATUS_ID=?,
NET_TYPE_NAME=?,
NET_TYPE_NOTE=?,
NET_TYPE_ORDER=?
where
NET_TYPE_CODE=?
public void save(T entity) {
getHibernateTemplate().saveOrUpdate(entity);
}