Reputation: 3801
I am running postgresql version 9.2 and when the tables are queried from the DB, I receive this error:
Caused by: org.hibernate.exception.SQLGrammarException: could not get table metadata: ACCOUNTINGINFO
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:128)
at org.hibernate.cfg.Configuration.generateSchemaUpdateScript(Configuration.java:1202)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean$1.doInHibernate(LocalSessionFactoryBean.java:946)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:407)
... 118 more
Caused by: org.postgresql.util.PSQLException: ERROR: column t1.tgconstrname does not exist
Position: 113
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:283)
at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedExportedKeys(AbstractJdbc2DatabaseMetaData.java:3552)
at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedKeys(AbstractJdbc2DatabaseMetaData.java:3745)
at org.apache.commons.dbcp.DelegatingDatabaseMetaData.getImportedKeys(DelegatingDatabaseMetaData.java:314)
at org.hibernate.tool.hbm2ddl.TableMetadata.initForeignKeys(TableMetadata.java:161)
at org.hibernate.tool.hbm2ddl.TableMetadata.<init>(TableMetadata.java:60)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.getTableMetadata(DatabaseMetadata.java:113)
... 121 more
It seems to be that the query is executed by jdbc2 instead of jdbc4:
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
From what I've investigated the column tgconstrname does not longer exist from version 8.4 of postgresql, but how to prevent this error? How to configure postgresql to use jdbc4 as the driver package?
Upvotes: 1
Views: 2643
Reputation: 73558
That's just how the driver is built. You have features that are included back in JDBC2, then you have additional features included in later versions. Things like metadata has been implemented in JDBC2 already, and the package name reflects that.
You can pick up a newer driver and still see org.postgresql.jdbc2
classes there. You didn't indicate the version of your driver, but I'd recommend getting a newer one while you're at it. They're backwards compatible, so the newest one works fine for 9.2
. Your current driver seems to be outdated.
Upvotes: 4