org.hibernate.exception.SQLGrammarException: could not execute update query

流域天韵 2014-04-18 04:43:38
IcWarehouseCheckBillDetail的实体类

public class IcWarehouseCheckBillDetail implements java.io.Serializable {

// Fields

private IcWarehouseCheckBillDetailId id;
private String productId;
private String productName;

// Constructors

/** default constructor */
public IcWarehouseCheckBillDetail() {
}

/** minimal constructor */
public IcWarehouseCheckBillDetail(IcWarehouseCheckBillDetailId id) {
this.id = id;

}
public IcWarehouseCheckBillDetail(IcWarehouseCheckBillDetailId id,String productId,String productName) {
this.id = id;
this.productId = productId;
this.productName = productName;
}
// Property accessors

public IcWarehouseCheckBillDetailId getId() {
return this.id;
}

public void setId(IcWarehouseCheckBillDetailId id) {
this.id = id;
}

public String getProductId() {
return productId;
}

public void setProductId(String productId) {
this.productId = productId;
}

public String getProductName() {
return productName;
}

public void setProductName(String productName) {
this.productName = productName;
}

}


IcWarehouseCheckBillDetailId的实体类

public class IcWarehouseCheckBillDetailId implements java.io.Serializable {

// Fields

private String companyId;

private String stockCheckId;

private String guid;

// Constructors

/** default constructor */
public IcWarehouseCheckBillDetailId() {
}

/** full constructor */
public IcWarehouseCheckBillDetailId(String companyId, String stockCheckId,
String guid) {
this.companyId = companyId;
this.stockCheckId = stockCheckId;
this.guid = guid;
}

// Property accessors

public String getCompanyId() {
return this.companyId;
}

public void setCompanyId(String companyId) {
this.companyId = companyId;
}

public String getStockCheckId() {
return this.stockCheckId;
}

public void setStockCheckId(String stockCheckId) {
this.stockCheckId = stockCheckId;
}

public String getGuid() {
return this.guid;
}

public void setGuid(String guid) {
this.guid = guid;
}

public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof IcWarehouseCheckBillDetailId))
return false;
IcWarehouseCheckBillDetailId castOther = (IcWarehouseCheckBillDetailId) other;

return ((this.getCompanyId() == castOther.getCompanyId()) || (this
.getCompanyId() != null
&& castOther.getCompanyId() != null && this.getCompanyId()
.equals(castOther.getCompanyId())))
&& ((this.getStockCheckId() == castOther.getStockCheckId()) || (this
.getStockCheckId() != null
&& castOther.getStockCheckId() != null && this
.getStockCheckId().equals(castOther.getStockCheckId())))
&& ((this.getGuid() == castOther.getGuid()) || (this.getGuid() != null
&& castOther.getGuid() != null && this.getGuid()
.equals(castOther.getGuid())));
}

public int hashCode() {
int result = 17;

result = 37 * result
+ (getCompanyId() == null ? 0 : this.getCompanyId().hashCode());
result = 37
* result
+ (getStockCheckId() == null ? 0 : this.getStockCheckId()
.hashCode());
result = 37 * result
+ (getGuid() == null ? 0 : this.getGuid().hashCode());
return result;
}

}

执行的Java代码是

Session session = this.getSessionFactory().openSession();
String delSql = "delete IcWarehouseCheckBillDetail where id.stockCheckId = '"+stockCheckId+"'";
Query delQuery = session.createQuery(delSql);
delQuery.executeUpdate();


产生的异常:

org.hibernate.exception.SQLGrammarException: could not execute update query
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:99)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:297)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:871)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at com.testwebsvc.service.TaskService.commitFirmCheck(TaskService.java:2501)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: ORA-00904: "ICWAREHOUS0_"."STOCK_CHECK_ID": 标识符无效

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at org.hibernate.hql.ast.UpdateStatementExecutor.execute(UpdateStatementExecutor.java:76)
... 29 more



请教大神,为什么说是“ "ICWAREHOUS0_"."STOCK_CHECK_ID": 标识符无效”引起的呢,明明我的代码里面没有ICWAREHOUSE0_
...全文
306 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧