PROBLEM
When upgrading to Hibernate 5, the following exception is thrown:-
Caused by: java.sql.SQLException: Incorrect syntax near '@P0'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) ~[jtds-1.3.1.jar:1.3.1]
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) ~[jtds-1.3.1.jar:1.3.1]
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) ~[jtds-1.3.1.jar:1.3.1]
SOLUTION
Change the MS SQL Server dialect from this…
org.hibernate.dialect.SQLServerDialect
… to this …
org.hibernate.dialect.SQLServer2012Dialect
Leave a Reply