有点特别的问题,但这是我一直在努力解决的问题。
我在WebLogic11g上使用了OpenJPA 1.2.3,调用了Sybase数据库上的存储过程。使用com.sybase.jdbc2.jdbc.SybDriver.最近,我们升级到了Weblogic 12c,而这种配置并没有像我们希望的那样正常工作。当超出执行存储过程调用的应用程序时,它将
javax.persistence.PersistenceException: java.lang.AbstractMethodError: weblogic.jdbc.wrapper.DatabaseMetaData_com_sybase_jdbc2_jdbc_SybDatabaseMetaData.getDatabaseMajorVersion() 升级到较新的驱动程序com.sybase.jdbc4.jdbc.SybDriver
现在我得到了
org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: JZ0S8: An escape sequence in a SQL Query was malformed: '{call mydb..my_stored_procedure @input=?'. Error Code: 0 at
weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:117) at如有必要,可以提供完整的堆栈跟踪。
我的实体:
package com.example.ejb.entities;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedNativeQuery;
@Entity
@NamedNativeQuery(name="my_stored_procedure",
query="{call mydb..my_stored_procedure @input=?}",
resultClass=EntityJPA.class)
public class EntityJPA implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@Column(name="id")
private String id;
@Column(name="input")
private int input;
@Column(name="statuscode")
private String statuscode;
@Column(name="statusdescription")
private String statusdescription;
public String getStatuscode() {
return statuscode;
}
public void setStatuscode(String statuscode) {
this.statuscode = statuscode;
}
public String getStatusdescription() {
return statusdescription;
}
public void setStatusdescription(String statusdescription) {
this.statusdescription = statusdescription;
}
public int getInput() {
return input;
}
public void setInput(int input) {
this.input = input;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}这在WebLogic 11g上很有魅力。
有人能指出正确的方向吗?这样就可以解决这个错误了吗?
发布于 2015-01-30 13:19:20
在我看来,基于错误消息中缺少关闭大括号,?}序列正在被咀嚼。尝试( a)以某种方式分离它们,或者( b)使用命名的参数表示法,比如:input,而不是?。
https://stackoverflow.com/questions/28223080
复制相似问题