[英]SQLCODE=-206, SQLSTATE=42703, SQLERRMC=SEQNAME, DRIVER=4.8.86
i have exception in my code.我的代码中有异常。 i use frameworks Spring, JPA, Hibernate
我使用框架 Spring、JPA、Hibernate
maven is:行家是:
<!-- DB2 Connection -->
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4</artifactId>
<version>10.5</version>
</dependency>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4_license_cisuz</artifactId>
<version>10.5</version>
</dependency>
<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4_license_cu</artifactId>
<version>10.5</version>
</dependency>
and to :并 :
@Entity
@Table( name="...", schema="..." )
public class Branch {
@Id
@Column(name = "O1001ID")
private Long id;
@Column(name = "O1001NAM")
private String name;
@Column(name = "O1001COD")
private String code;
// getter and setter
}
and error is错误是
SQLCODE=-206, SQLSTATE=42703, SQLERRMC=SEQNAME, DRIVER=4.8.86
I want to know What is SEQNAME?我想知道什么是SEQNAME? Did I define it somewhere?
我在某处定义了吗?
Try adding尝试添加
logging.level.org.springframework.web=INFO
logging.level.org.hibernate=INFO
logging.file=c:/temp/my-log/app.log
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
in your application.properties
, this will show you some trace queries.在您的
application.properties
,这将显示一些跟踪查询。
I had this problem before becouse the JPA is formating your query for example if you are calling Repository.count();
我之前遇到过这个问题,因为 JPA 正在格式化您的查询,例如,如果您正在调用
Repository.count();
the query will be formated as select count(u) From table u
which is in invalid format for the DB2, to overcome this i had to define my own @Query
to be select count(*) From table u
.查询将被格式化为
select count(u) From table u
这对于 DB2 来说是无效格式,为了克服这个问题,我必须将我自己的@Query
定义为select count(*) From table u
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.