2

I'm facing a problem with a Java application (JVM 1.6) that is using Hibernate 3.6 to access a Microsoft SQL Server via Microsoft JDBC Driver for SQL Server.

When working with SQL JDBC driver 3.0 and MSSQL 2008 - 2014 all is working just fine.

But when I'm trying to use MSSQL 2016, the latest "Microsoft JDBC Driver 6.0" (sqljdbc4.jar) - I get a bunch of those errors:

org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

It happens on different entities, and can happen on a get or update operations.

My question: is this an issue with Hibernate that also needs to be updated to a newer version? I wasn't able to find any information about compatibility issues when accessing MSSQL 2016 via Java/Hibernate.

Thanks!

oferbar
  • 176
  • 2
  • 16
  • http://stackoverflow.com/questions/3158491/staleobjectstateexception-row-was-updated-or-deleted-by or http://stackoverflow.com/questions/8645694/row-was-updated-or-deleted-by-another-transaction-or-unsaved-value-mapping-was might be relevant – Vimal Bera Sep 26 '16 at 12:08
  • [This](http://stackoverflow.com/questions/16732156/how-to-solve-org-hibernate-staleobjectstateexception-when-copying-data-from-one) also seems relevant. – Tim Biegeleisen Sep 26 '16 at 12:10
  • Thanks for replying. I've seen these posts before asking here, and unfortunately they did not provide a solution to my problem. – oferbar Sep 27 '16 at 06:10

1 Answers1

1

If possible can you try to use JVM 1.7 and sqljdbc41.jar? Better if you able to use JVM 1.8 and sqljdbc42.jar.

Microsoft recently Open Source their driver on GitHub. You can raise issue on their github project.

As per my understanding for SQL Server 2016 you need either sqljdbc41.jar or sqljdbc42.jar

Further you can found more official documentation on MSDN.

Microsoft JDBC Driver 6.0 and 4.2 for SQL Server: To support backward compatibility and possible upgrade scenarios, the JDBC Drivers 6.0 and 4.2 include four JAR class libraries in each installation package: sqljdbc.jar, sqljdbc4.jar, sqljdbc41.jar, and sqljdbc42.jar. Note: sqljdbc.jar, sqljdbc4.jar are provided only for backwards compatibility, and do not contain new features included with driver versions 6.0, 4.2, and 4.1.

Nikhil
  • 570
  • 5
  • 12
  • I believe you are correct. We have recently added JVM 1.8 support to the application, so the next step would be to try it out. Thanks! – oferbar Dec 07 '16 at 21:18