Hibernate: delete from tblOrderType where OrderTypeNo in (OrderType_18603477058015)
2012-07-03 14:47:41 SQL Error: 207, SQLState: S0001
2012-07-03 14:47:41 列名 'OrderType_18603477058015' 无效。
OrderType.hbm.xml 配置<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.angenic.order.bean.OrderType" table="tblOrderType" batch-size="20">
<id name="orderTypeNo" type="java.lang.String" column="OrderTypeNo"/>
<property name="name" type="java.lang.String" column="Name"/>
<property name="details" type="java.lang.String" column="Details"/>
<property name="creationDate" type="java.util.Date" column="CreationDate"/>
</class>
</hibernate-mapping>OrderType.javapackage com.angenic.order.bean;import java.io.Serializable;
import java.util.Date;import com.angenic.common.hibernate.bean.Entity;@SuppressWarnings("serial")
public class OrderType implements Entity, Serializable {
private String orderTypeNo;
private String name;
private String details;
private Date creationDate; public String getOrderTypeNo() {
return orderTypeNo;
} public void setOrderTypeNo(String orderTypeNo) {
this.orderTypeNo = orderTypeNo;
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public String getDetails() {
return details;
} public void setDetails(String details) {
this.details = details;
} public Date getCreationDate() {
return creationDate;
} public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
} public Serializable getId() {
return orderTypeNo;
}}
OrderTypeAction delete方法继承了,所以不用写了。
package com.angenic.order.web;import com.angenic.common.hibernate.search.MyCriteria;
import com.angenic.common.hibernate.search.MyCriteriaFactory;
import com.angenic.common.service.BaseService;
import com.angenic.common.struts.web.BaseActionSupport;
import com.angenic.order.bean.OrderType;
import com.angenic.order.service.OrderTypeService;@SuppressWarnings("serial")
public class OrderTypeAction extends BaseActionSupport<OrderType> {
OrderTypeService orderTypeService = null;
OrderType orderType = null;
@Override
public String list() {
MyCriteria criteria = MyCriteriaFactory.createCriteria(OrderType.class);
request.put("entityList",orderTypeService.findObjects(criteria, getPage()));
return LIST;
}
@Override
public String save() {
if(orderType.getOrderTypeNo() != null && !"".equals(orderType.getOrderTypeNo())){
orderTypeService.updateObject(orderType);
}else{
orderType.setOrderTypeNo(String.valueOf(OrderType.class.getSimpleName()+"_"+System.nanoTime()));
orderTypeService.saveObject(orderType);
}
return VIEW;
} @Override
protected BaseService<OrderType> getBaseService() {
return this.orderTypeService;
}
@Override
protected void setEntity(OrderType obj) {
this.orderType = obj;
}
@Override
protected OrderType getEntity() {
return this.orderType;
} public OrderTypeService getOrderTypeService() {
return orderTypeService;
}
public void setOrderTypeService(OrderTypeService orderTypeService) {
this.orderTypeService = orderTypeService;
}
public OrderType getOrderType() {
return orderType;
}
public void setOrderType(OrderType orderType) {
this.orderType = orderType;
}
}
2012-07-03 14:47:41 SQL Error: 207, SQLState: S0001
2012-07-03 14:47:41 列名 'OrderType_18603477058015' 无效。
OrderType.hbm.xml 配置<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.angenic.order.bean.OrderType" table="tblOrderType" batch-size="20">
<id name="orderTypeNo" type="java.lang.String" column="OrderTypeNo"/>
<property name="name" type="java.lang.String" column="Name"/>
<property name="details" type="java.lang.String" column="Details"/>
<property name="creationDate" type="java.util.Date" column="CreationDate"/>
</class>
</hibernate-mapping>OrderType.javapackage com.angenic.order.bean;import java.io.Serializable;
import java.util.Date;import com.angenic.common.hibernate.bean.Entity;@SuppressWarnings("serial")
public class OrderType implements Entity, Serializable {
private String orderTypeNo;
private String name;
private String details;
private Date creationDate; public String getOrderTypeNo() {
return orderTypeNo;
} public void setOrderTypeNo(String orderTypeNo) {
this.orderTypeNo = orderTypeNo;
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public String getDetails() {
return details;
} public void setDetails(String details) {
this.details = details;
} public Date getCreationDate() {
return creationDate;
} public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
} public Serializable getId() {
return orderTypeNo;
}}
OrderTypeAction delete方法继承了,所以不用写了。
package com.angenic.order.web;import com.angenic.common.hibernate.search.MyCriteria;
import com.angenic.common.hibernate.search.MyCriteriaFactory;
import com.angenic.common.service.BaseService;
import com.angenic.common.struts.web.BaseActionSupport;
import com.angenic.order.bean.OrderType;
import com.angenic.order.service.OrderTypeService;@SuppressWarnings("serial")
public class OrderTypeAction extends BaseActionSupport<OrderType> {
OrderTypeService orderTypeService = null;
OrderType orderType = null;
@Override
public String list() {
MyCriteria criteria = MyCriteriaFactory.createCriteria(OrderType.class);
request.put("entityList",orderTypeService.findObjects(criteria, getPage()));
return LIST;
}
@Override
public String save() {
if(orderType.getOrderTypeNo() != null && !"".equals(orderType.getOrderTypeNo())){
orderTypeService.updateObject(orderType);
}else{
orderType.setOrderTypeNo(String.valueOf(OrderType.class.getSimpleName()+"_"+System.nanoTime()));
orderTypeService.saveObject(orderType);
}
return VIEW;
} @Override
protected BaseService<OrderType> getBaseService() {
return this.orderTypeService;
}
@Override
protected void setEntity(OrderType obj) {
this.orderType = obj;
}
@Override
protected OrderType getEntity() {
return this.orderType;
} public OrderTypeService getOrderTypeService() {
return orderTypeService;
}
public void setOrderTypeService(OrderTypeService orderTypeService) {
this.orderTypeService = orderTypeService;
}
public OrderType getOrderType() {
return orderType;
}
public void setOrderType(OrderType orderType) {
this.orderType = orderType;
}
}
解决方案 »
- 后台管理网站,提交很多项,每一项又有很多数据,怎么能够确保数据的完整性呢
- jsp连接oracle 10g问题
- 请问如何用java或jsp调用google或者其他翻译工具翻译网页呢??
- struts2+spring与jdk版本兼容性问题,急~~~~~~~~~~~~~~~~~~
- 忍痛给1000分,commons-fileupload-1.1上传老是出错,顶者有分
- File "/WEB-INF/struts-bean.tld" not found ???
- 求救tomcat 的ssl 配置
- 求解:JSP的会话问题
- 遍历问题
- form表单里面的action
- 求大虾指教~
- 大家帮忙想想办法,如何从一篇文章中截取身份证号!!!!急急。。
主键是自增还是什么类型,怎么没有设置
主键 不是自增的,已经写死了.
String类型。
<id name="orderTypeNo" type="java.lang.String">
<column length="20" name="OrderTypeNo"/>
<generator class="uuid">
</id>
public void deleteObject(T obj) {
try {
if (getBaseValidate().validateDelete(new Serializable[] { obj.getId() })) {
getHibernateDAO().delete(obj);
this.addMessage("common.message.delete.success", new String[] { getText(obj.getClass().getName()) });
}
}catch (MyErrorLocalMessageException e) {
this.clearResults();
throw e;
}
} public void deleteObject(Serializable id) {
try {
if (getBaseValidate().validateDelete(new Serializable[] { id })) {
getHibernateDAO().delete(id);
this.addMessage("common.message.delete.success", new String[] { getText(getHibernateDAO().getEntityName()) });
}
} catch (MyErrorLocalMessageException e) {
this.clearResults();
throw e;
}
} public void deleteObjects(Serializable[] ids) {
try {
if (getBaseValidate().validateDelete(ids)) {
getHibernateDAO().deletes(ids);
}
} catch (MyErrorLocalMessageException e) {
this.clearResults();
throw e;
}
}
public void deleteObject(Serializable[] ids) {
try {
if (getBaseValidate().validateDelete(ids)) {
getHibernateDAO().delete(ids);
}
} catch (MyErrorLocalMessageException e) {
this.clearResults();
throw e;
}
}