Upgrade fails with SQL Dialect, net.sf.hibernate.dialect.SQLServerDialect

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

Problems

Upgrading from 5.9.2 to 5.9.3 fails with the following error message:

1 2 3 4 5 6 7 2021-05-06 10:56:51,671 INFO [localhost-startStop-1] [confluence.upgrade.ddl.HibernateDdlExecutor] executeDdlStatements Executing DDL: drop table USER_RELATION 2021-05-06 10:56:51,720 INFO [localhost-startStop-1] [confluence.upgrade.ddl.HibernateDdlExecutor] executeDdlStatements Executing DDL: drop table CONTENT_RELATION 2021-05-06 10:56:51,761 INFO [localhost-startStop-1] [confluence.upgrade.ddl.HibernateDdlExecutor] executeDdlStatements Executing DDL: drop table USERCONTENT_RELATION 2021-05-06 10:56:52,437 ERROR [localhost-startStop-1] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Unsuccessful: alter table USER_RELATION add constraint FK_U2URELATION_LASTMODIFIER foreign key (LASTMODIFIER) references user_mapping 2021-05-06 10:56:52,437 ERROR [localhost-startStop-1] [hibernate.tool.hbm2ddl.SchemaUpdate] execute Column 'user_mapping.user_key' is not the same data type as referencing column 'USER_RELATION.LASTMODIFIER' in foreign key 'FK_U2URELATION_LASTMODIFIER'. 2021-05-06 10:56:52,437 ERROR [localhost-startStop-1] [hibernate.tool.hbm2ddl.SchemaUpdate] execute could not complete schema update java.sql.SQLException: Column 'user_mapping.user_key' is not the same data type as referencing column 'USER_RELATION.LASTMODIFIER' in foreign key 'FK_U2URELATION_LASTMODIFIER'.

Environment

5.9.2

MS SQL Server

Diagnosis

  1. Check the SQL Dialect in the confluence.cfg.xml has the dialect as the following:

1 <property name="hibernate.dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

2. Check the USER_RELATION.LASTMIDFIER data type is varchar with the following query:

1 select COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.COLUMNS where table_name = 'USER_RELATION'

Solution

The issue was caused by the incorrect dialect for the MS SQL server, and it can be fixed by change it to the following:

1 <property name="hibernate.dialect">net.sf.hibernate.dialect.SQLServerIntlDialect</property>
Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.