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:
create table file_name_mapping (id bigint identity not null, index int not null, original_name
varchar(255) not null, tms_name varchar(255) not null, project_id bigint not null, primary
key (id))
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:
select filenamema0_.id as id1_0_, filenamema0_.index as index2_0_, filenamema0_.original_name
as original3_0_, filenamema0_.project_id as project_5_0_, filenamema0_.tms_name as tms_name4_0_
from file_name_mapping filenamema0_ where filenamema0_.project_id=1
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:
spring.datasource.url=jdbc:jtds:sqlserver:spring.datasource.driver-class-name=net.sourceforge.jtds.jdbc.Driver
spring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServerDialect
|