-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException after upgrading JDBC-driver from 6.4 to 7.0 #788
Comments
Hi @christophs78, I wasn't able to create an exact repro described in the issue, but I was able to reproduce the error. I believe the underlying cause for both the errors are the same, and have made a fix to the driver. Can you test these new jars and see if it solves the problem? |
Hi @rene-ye! Thank´s for your update!
(Full Stacktrace further down.) I´ll try to build a sandbox-eclipse-project for this issue. (Hibernate without Spring) Would this help? Kind regards, Christoph
|
Eclipse-Sandbox-Projekt: It uses gradle (build.gradle) to load dependencies. (hibernate and mssql-jdbc) Remove the mssql-jdbc-dependency to test against your own version of the jdbc-driver. Adapt persistence.xml to connect to your database. |
Hi @christophs78, the sandbox reproduction you provided works and I can confirm the error on my end. I've updated the change and provided an initial version of the fix below. Please see if it resolves the issue. |
Yes, it resolves the issue. :-) |
I have encountered the same problem, thanks to @rene-ye , can you tell us the release date of the final version of 7.1.1? |
7.1.1-preview will be released when all its milestones are completed, which is currently targeted for end-of-month. |
…se the stream for Clobs/NClobs (#799) Addresses #788. Also addressed an issue where varchar(max)/Clob objects were always being encoded to UTF-16LE instead of using the Collation specified in the Clob object. List of Changes (the following applies to NClob as well): 1. calling Clob.length() no longer attempts to load the stream into a string. This fixes a null pointer issue as well as length() closing user streams. 2. added streaming capabilities for Clob.getAsciiStream(). NClobs will always have a non-streaming implementation for getAsciiStream(). 3. Clobs no longer default to UTF-16LE. Clobs now respect the collation from the SQL Server. NClobs remain unchanged, will always be UTF-16LE encoding.
#799 has been merged and will be available starting from the next preview release. Closing the issue. |
Driver version or jar name
mssql-jdbc-7.0.0.jre8.jar
SQL Server version
13.0.4001.0
Client operating system
Windows 10 1709
(But i think it does not matter.)
Java/JVM version
Java HotSpot(TM) 64-Bit Server VM, Version 1.8.0_171-b1 (Oracle)
(But i think it does not matter.)
Table schema
Sorting: Latin1_general_CI_AS
Compatibility: SQL Server 2012 (110)
Problem description
Caused by: java.lang.NullPointerException
at com.microsoft.sqlserver.jdbc.SQLServerClobBase.length(SQLServerClob.java:388)
at com.microsoft.sqlserver.jdbc.SQLServerClob.length(SQLServerClob.java:97)
at org.hibernate.type.descriptor.java.DataHelper.determineLengthForBufferSizing(DataHelper.java:285)
at org.hibernate.type.descriptor.java.DataHelper.extractString(DataHelper.java:264)
...
at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1445)
at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1414)
at org.hibernate.query.Query.getResultList(Query.java:146)
at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:72)
...
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
at com.sun.proxy.$Proxy146.findAllByOrderByServiceNameAsc(Unknown Source)
at iete.view.RecordIssueView.init(RecordIssueView.java:45)
There was a change in SQLServerClobBase.length with Version 7.0.
b60068c
Expected behavior and actual behavior
NullPointerException should not be thrown.
Repro code
Database-View:
JPA-Model-Class:
SpringData-Repository:
The text was updated successfully, but these errors were encountered: