Using Postgres and creating Entities via Spring JPA and Hibernate…
There is a table with a column that has a #
in the name and seems to be causing issues when hibernate tries to access the field…
@ Entity
@ Table(name = "SOMETABLE", schema = "ASCHEMA")
public class GroupDivisionPayPeriod implements Serializable {
...
@ Column(name = "\"PAYFIELD#\"", length = 2)
public Long payPeriod;
...
}
As you can see i have tried escaping with quotes but that still gives me an error:
Caused by: org.postgresql.util.PSQLException: ERROR: column sometab0_.payfield# does not exist
Position: 93
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:353)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:82)
I am not sure if this is a Postgres issue or a Hibernate issue?