Skip to content

caching column name case #6

@asvinours

Description

@asvinours

Hello,

it seems that the fact the column cachingEnabled is using camelcase instead of all lowercase and/or snake_case is causing major issues when using PostgreSQL

confighub_1  | Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
confighub_1  |  at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:106)
confighub_1  |  at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
confighub_1  |  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
confighub_1  |  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:97)
confighub_1  |  at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:69)
confighub_1  |  at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet(AbstractLoadPlanBasedLoader.java:419)
confighub_1  |  at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeQueryStatement(AbstractLoadPlanBasedLoader.java:191)
confighub_1  |  at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:121)
confighub_1  |  at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:86)
confighub_1  |  at org.hibernate.loader.collection.plan.AbstractLoadPlanBasedCollectionInitializer.initialize(AbstractLoadPlanBasedCollectionInitializer.java:87)
confighub_1  |  at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:688)
confighub_1  |  at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:75)
confighub_1  |  at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:2223)
confighub_1  |  at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:565)
confighub_1  |  at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:247)
confighub_1  |  at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:561)
confighub_1  |  at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:132)
confighub_1  |  at org.hibernate.collection.internal.PersistentSet.iterator(PersistentSet.java:163)
confighub_1  |  at java.util.AbstractCollection.addAll(AbstractCollection.java:343)
confighub_1  |  at com.confighub.api.user.dashboard.GetDashboardElements.get(GetDashboardElements.java:62)
confighub_1  |  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
confighub_1  |  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
confighub_1  |  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
confighub_1  |  at java.lang.reflect.Method.invoke(Method.java:498)
confighub_1  |  at org.apache.openejb.server.cxf.rs.PojoInvoker.performInvocation(PojoInvoker.java:43)
confighub_1  |  at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
confighub_1  |  ... 34 more
confighub_1  | Caused by: org.postgresql.util.PSQLException: ERROR: column repository1_.cachingenabled does not exist
confighub_1  |   Hint: Perhaps you meant to reference the column "repository1_.cachingEnabled".
confighub_1  |   Position: 472
confighub_1  |  at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2477)
confighub_1  |  at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2190)
confighub_1  |  at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
confighub_1  |  at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428)
confighub_1  |  at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354)
confighub_1  |  at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:169)
confighub_1  |  at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:117)
confighub_1  |  at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
confighub_1  |  ... 55 more

Even though the column is named properly in the DB:

confighub=# \d repository
                               Table "public.repository"
         Column          |            Type             | Collation | Nullable | Default 
-------------------------+-----------------------------+-----------+----------+---------
 id                      | bigint                      |           | not null | 
 diffjson                | text                        |           |          | 
 accesscontrolenabled    | boolean                     |           |          | 
 active                  | boolean                     |           |          | 
 admincontextcontrolled  | boolean                     |           |          | false
 allowtokenfreeapipull   | boolean                     |           |          | false
 allowtokenfreeapipush   | boolean                     |           |          | false
 contextclustersenabled  | boolean                     |           |          | false
 createdate              | timestamp without time zone |           | not null | 
 demo                    | boolean                     |           |          | 
 depth                   | character varying(255)      |           | not null | 
 depthlabels             | character varying(255)      |           | not null | 
 description             | character varying(255)      |           |          | 
 isprivate               | boolean                     |           | not null | 
 name                    | character varying(255)      |           | not null | 
 securityprofilesenabled | boolean                     |           |          | true
 valuetypeenabled        | boolean                     |           |          | true
 accountid               | bigint                      |           |          | 
 confirmcontextchange    | boolean                     |           |          | false
 cachingEnabled          | boolean                     |           |          | false

I did some research and found this article explaining the issue: https://blog.xojo.com/2016/09/28/about-postgresql-case-sensitivity/

Any reason for the new cachingEnabled column to not follow the same standard that the rest of the DB schema?
Seems in v1.8 changes there was already a change file to switch camelCase db names to snake_case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions