Error using column named "index" on jTDS/SQL-Server

Description

Apologies if this is not the correct location.

When using Spring Boot 1.2.3.RELEASE, which uses Hibernate 4.3.8.Final, I get an error trying to use a table with the column name "index". The generated SQL does not escape the column name, which conflicts with the reserved word INDEX.

Create SQL:

java.sql.SQLException: Incorrect syntax near 'index'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)

Insert SQL:

java.sql.SQLException: Incorrect syntax near 'index'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)

Modifying the generated SQL with double-quotes around each column name avoids this problem.

I am use the jTDS driver for SQL Server. My JDBC configuration is as follows:

Environment

None

Activity

Show:
Chris Pimlott
April 22, 2015, 6:40 PM

I am also setting ddl-auto=update to have Hibernate automatically create the table for me.

Gail Badner
April 22, 2015, 7:27 PM

This is expected behavior.

Assignee

Gail Badner

Reporter

Chris Pimlott

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Affects versions

Priority

Major
Configure