I have an Oracle table with a column named with a reserved word (TYPE)
This is defined in the entity class as
@Entity
@Table(name="PROCESS_STORAGE")
.....
@Column(name="\"TYPE\"")
private String type;
But trying to retrieve a record from the DB causes an error:
2018-01-05 11:50:54.139 WARN 9340 --- [http-nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 904, SQLState: 42000
2018-01-05 11:50:54.139 ERROR 9340 --- [http-nio-8080-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : ORA-00904: "PROCESSSTO0_"."type": invalid identifier
2018-01-05 11:50:54.144 ERROR 9340 --- [http-nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet] with root cause
java.sql.SQLSyntaxErrorException: ORA-00904: "PROCESSSTO0_"."type": invalid identifier
Not quite sure what I'm missing here. It seems to be quoting the column name, but it's not finding it?
Edit I've just realised it's a case sensitivity issue - the column is uppercase in the DB (TYPE) and in the entity definition, but for some reason it's getting converted to lowercase in the query. Still not sure why this is happening though