【发布时间】:2017-02-01 04:58:24
【问题描述】:
我正在使用 jtds 驱动程序通过 SpringBoot+JPA 应用程序的 Windows 身份验证从 UnixBox 连接到 SQLServer。它是一个独立的应用程序,而不是基于 Web 的应用程序。我能够成功连接到相同的设备,但是当我尝试使用 JPARepository 保存一些数据时,我收到以下异常:
java.lang.AbstractMethodError: null
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setCharacterStream(JtdsPreparedStatement.java:1274) ~[jtds-1.3.1.jar:1.3.1]
查看了JtdsPreparedStatement中对应的源码,发现没有这个方法的实现:
@Override
public void setCharacterStream(int parameterIndex, Reader reader,
long length) throws SQLException {
// TODO Auto-generated method stub
throw new AbstractMethodError();
}
如建议here;我们可以实现相同的,它应该可以工作。有人可以解释一下如何注册我的 JtdsPreparedStatement 实现,以便在运行时由 Spring 容器而不是默认容器选择?或者是否有其他可用选项?
编辑:JtdsPreparedStatement 有一个默认作用域的构造函数;甚至不能扩展它
【问题讨论】:
标签: sql-server hibernate jpa spring-boot jtds