Getting 'generate could not read a hi value java.sql.SQLException Invalid object name 'hibernate_unique_key' SQLException Error

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Using SQL Server database, after migrating databases or restoring sql dumps under certain conditions, the following appears in the atlassian-confluence.log:

2009-06-02 14:26:42,223 ERROR [DefaultQuartzScheduler_Worker-1] [sf.hibernate.id.TableGenerator] generate could not read a hi value
java.sql.SQLException: Invalid object name 'hibernate_unique_key'.
	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
	at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
	at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
	at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:418)
	at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:693)
	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
	at net.sf.hibernate.id.TableGenerator.generate(TableGenerator.java:94)
	at com.atlassian.hibernate.ResettableTableHiLoGenerator.generate(ResettableTableHiLoGenerator.java:62)
...
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy55.verify(Unknown Source)
	at com.atlassian.confluence.cluster.safety.ClusterSafetyJob.executeJob(ClusterSafetyJob.java:13)
	at com.atlassian.confluence.setup.quartz.AbstractClusterAwareQuartzJobBean.surroundJobExecutionWithLogging(AbstractClusterAwareQuartzJobBean.java:64)
...

Causes

  1. The SQL Server database was created or recreated with tables with the incorrect case, either capital or lower-case.
  2. The schema name of Confluence database is not the default schema name which is dbo (MS SQL Server).
  3. The hibernate_unique_key table is empty and the next_hi column has a null value in it. 

Resolution

  1. Check Database Setup for SQL Server to ensure that collation and case-sensitivity is configured correctly.
  2. Contact your database administrators and request to change the schema name to dbo. For reference see this link.
  3. Run the following query to confirm if the table is populated:

    SELECT max(next_hi) FROM hibernate_unique_key;
    

    If it returns a null instead of a numeric value, shut down you instance and run the following query:

    insert into hibernate_unique_key (next_hi) values (0);
    

 

 

 

 

 

 

Last modified on Jun 1, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.