Getting 'generate could not read a hi value java.sql.SQLException Invalid object name 'hibernate_unique_key' SQLException Error
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Using SQL Server database, after migrating databases or restoring sql dumps under certain conditions, the following appears in the atlassian-confluence.log
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
The SQL Server database was created or recreated with tables with the incorrect case, either capital or lower-case.
The schema name of Confluence database is not the default schema name which is
dbo
(MS SQL Server).The hibernate_unique_key table is empty and the next_hi column has a null value in it.
Resolution
Check Database Setup for SQL Server to ensure that collation and case-sensitivity is configured correctly.
Contact your database administrators and request to change the schema name to
dbo
. For reference see this link.Run the following query to confirm if the table is populated:
1
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:
1
insert into hibernate_unique_key (next_hi) values (0);
Was this helpful?