Обсуждение: Problem with Hibernate/Spring/Postgres configuraiton
Converting an existing Hibernate/Spring/Oracle application over to using Postgres. Changed the JDBC driver and data source, but now hitting an error that does not appear reported in any of the hibernate or postgres forums.
In trying to do a simple insert, I am getting:
ERROR org.hibernate.util.JDBCExceptionReporter - Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
The relevant configuration is:
<!-- DataSource Setup -->
< bean id = "pgDataSource"
class = "org.apache.commons.dbcp.BasicDataSource"
destroy-method= "close" >
< property name = "driverClassName" value = "org.postgresql.Driver" />
< property name = "url" value = "jdbc:postgresql://localhost:5432/postgres" />
< property name = "username" value = "postgres" />
< property name = "password" value = "postgres" />
</bean >
Don't see any way to tell Dbcp or Hibernate not to use query timeouts -- seems to be part of the standard. Would appreciate your pointing me to the source of the problem.
Thanks...
(full error trace/ERROR near the bottom)
2008-10-04 14:40:02,781 [http-8080-1] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
2008-10-04 14:40:02,781 [http-8080-1] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
2008-10-04 14:40:02,781 [http-8080-1] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
2008-10-04 14:40:02,781 [http-8080-1] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/postgres
2008-10-04 14:40:02,781 [http-8080-1] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=postgres, password=****}
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - RDBMS: PostgreSQL, version: 8.3.4
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.3 JDBC4 with SSL (build 603)
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.PostgreSQLDialect
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Default schema: certiv
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Cache provider: org.hibernate.cache.NoCacheProvider
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
2008-10-04 14:40:02,859 [http-8080-1] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
2008-10-04 14:40:02,875 [http-8080-1] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
2008-10-04 14:40:03,406 [http-8080-1] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
2008-10-04 14:40:03,421 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update
2008-10-04 14:40:03,421 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata
2008-10-04 14:40:03,906 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - updating schema
2008-10-04 14:40:04,703 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: certiv.assertion
2008-10-04 14:40:04,718 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: [fkf47026e2575b43d7, fkf47026e24268da7d]
2008-10-04 14:40:04,718 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [assertion_pkey]
2008-10-04 14:40:04,812 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.TableMetadata - table found: certiv.authority
2008-10-04 14:40:04,812 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: [fkfe0c1723575b43d7, fkfe0c1723ff114e1d, fkfe0c1723b3816057]
2008-10-04 14:40:06,640 [http-8080-1] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - schema update complete
2008-10-04 14:40:06,781 [http-8080-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 0A000
2008-10-04 14:40:06,781 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - Method org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is not yet implemented.
2008-10-04 14:40:06,781 [http-8080-1] ERROR net.certiv.analytics.db.dao.service.RepositoryServiceDao - Save error
2008-10-04 14:40:06,812 [http-8080-1] INFO org.springframework.remoting.support.RemoteInvocationTraceInterceptor - Processing of HttpInvokerServiceExporter remote call resulted in exception: net.certiv.analytics.db.dao.service.AbstractService.save
net.certiv.nav.events.PersistException: Save failure.
at net.certiv.analytics.db.dao.service.RepositoryServiceDao.save( RepositoryServiceDao.java :75)
Hi, Try using the JDBC3 driver instead. It helped on GlassFish 2.0 for similar "is not yet implemented." problems Gerald Rosenberg wrote: > > Converting an existing Hibernate/Spring/Oracle application over to > using Postgres. Changed the JDBC driver and data source, but now > hitting an error that does not appear reported in any of the hibernate > or postgres forums. > > In trying to do a simple insert, I am getting: > > ERROR org.hibernate.util.JDBCExceptionReporter - Method > org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is > not yet implemented. > > The relevant configuration is: > > <!-- DataSource Setup --> > < bean id = /"pgDataSource" > /class = /"org.apache.commons.dbcp.BasicDataSource" > / destroy-method= /"close"/ > > < property name = /"driverClassName"/ value = /"org.postgresql.Driver"/ /> > < property name = /"url"/ value = > /"jdbc:postgresql://localhost:5432/postgres"/ /> > < property name = /"username"/ value = /"postgres"/ /> > < property name = /"password"/ value = /"postgres"/ /> > </bean > > > Don't see any way to tell Dbcp or Hibernate not to use query timeouts > -- seems to be part of the standard. Would appreciate your pointing > me to the source of the problem. > > Thanks... > > > (full error trace/ERROR near the bottom) > > 2008-10-04 14:40:02,781 [http-8080-1] INFO > org.hibernate.connection.DriverManagerConnectionProvider - Using > Hibernate built-in connection pool (not for production use!) > 2008-10-04 14:40:02,781 [http-8080-1] INFO > org.hibernate.connection.DriverManagerConnectionProvider - Hibernate > connection pool size: 20 > 2008-10-04 14:40:02,781 [http-8080-1] INFO > org.hibernate.connection.DriverManagerConnectionProvider - autocommit > mode: false > 2008-10-04 14:40:02,781 [http-8080-1] INFO > org.hibernate.connection.DriverManagerConnectionProvider - using > driver: org.postgresql.Driver at URL: > jdbc:postgresql://localhost:5432/postgres > 2008-10-04 14:40:02,781 [http-8080-1] INFO > org.hibernate.connection.DriverManagerConnectionProvider - connection > properties: {user=postgres, password=****} > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - RDBMS: PostgreSQL, version: 8.3.4 > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - JDBC driver: PostgreSQL Native > Driver, version: PostgreSQL 8.3 JDBC4 with SSL (build 603) > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.dialect.Dialect - Using dialect: > org.hibernate.dialect.PostgreSQLDialect > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.transaction.TransactionFactoryFactory - Transaction > strategy: org.hibernate.transaction.JDBCTransactionFactory > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.transaction.TransactionManagerLookupFactory - No > TransactionManagerLookup configured (in JTA environment, use of > read-write or transactional second-level cache is not recommended) > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Automatic flush during > beforeCompletion(): disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Automatic session close at end of > transaction: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - JDBC batch size: 15 > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned > data: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Connection release mode: auto > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Default schema: certiv > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1 > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: > disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: > disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Query translator: > org.hibernate.hql.ast.ASTQueryTranslatorFactory > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using > ASTQueryTranslatorFactory > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Query language substitutions: {} > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Second-level cache: enabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Query cache: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Cache provider: > org.hibernate.cache.NoCacheProvider > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: > disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Structured second-level cache > entries: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Statistics: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Deleted entity synthetic > identifier rollback: disabled > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo > 2008-10-04 14:40:02,859 [http-8080-1] INFO > org.hibernate.cfg.SettingsFactory - Named query checking : enabled > 2008-10-04 14:40:02,875 [http-8080-1] INFO > org.hibernate.impl.SessionFactoryImpl - building session factory > 2008-10-04 14:40:03,406 [http-8080-1] INFO > org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory > to JNDI, no JNDI name configured > 2008-10-04 14:40:03,421 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.SchemaUpdate - Running hbm2ddl schema update > 2008-10-04 14:40:03,421 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.SchemaUpdate - fetching database metadata > 2008-10-04 14:40:03,906 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.SchemaUpdate - updating schema > 2008-10-04 14:40:04,703 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.TableMetadata - table found: certiv.assertion > 2008-10-04 14:40:04,718 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: > [fkf47026e2575b43d7, fkf47026e24268da7d] > 2008-10-04 14:40:04,718 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.TableMetadata - indexes: [assertion_pkey] > 2008-10-04 14:40:04,812 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.TableMetadata - table found: certiv.authority > 2008-10-04 14:40:04,812 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.TableMetadata - foreign keys: > [fkfe0c1723575b43d7, fkfe0c1723ff114e1d, fkfe0c1723b3816057] > 2008-10-04 14:40:06,640 [http-8080-1] INFO > org.hibernate.tool.hbm2ddl.SchemaUpdate - schema update complete > 2008-10-04 14:40:06,781 [http-8080-1] WARN > org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 0A000 > 2008-10-04 14:40:06,781 [http-8080-1] ERROR > org.hibernate.util.JDBCExceptionReporter - Method > org.postgresql.jdbc4.Jdbc4PreparedStatement.setQueryTimeout(int) is > not yet implemented. > 2008-10-04 14:40:06,781 [http-8080-1] ERROR > net.certiv.analytics.db.dao.service.RepositoryServiceDao - Save error > 2008-10-04 14:40:06,812 [http-8080-1] INFO > org.springframework.remoting.support.RemoteInvocationTraceInterceptor > - Processing of HttpInvokerServiceExporter remote call resulted in > exception: net.certiv.analytics.db.dao.service.AbstractService.save > net.certiv.nav.events.PersistException: Save failure. > at net.certiv.analytics.db.dao.service.RepositoryServiceDao.save( > _RepositoryServiceDao.java_ :75)