-
Bug
-
Resolution: Done
-
Low
-
5.14.1
-
Severity 3 - Minor
-
Summary
While installing or upgrading Bamboo, the following ERROR message is observed in the logs:
2016-12-01 13:22:45,047 ERROR [localhost-startStop-1] [SchemaUpdate] HHH000388: Unsuccessful: alter table VCS_LOCATION add constraint FK_6lo84xenkp53fi9ke6mje2350 foreign key (PARENT_ID) references VCS_LOCATION 2016-12-01 13:22:45,047 ERROR [localhost-startStop-1] [SchemaUpdate] Column 'VCS_LOCATION.VCS_LOCATION_ID' is not the same data type as referencing column 'VCS_LOCATION.PARENT_ID' in foreign key 'FK_6lo84xenkp53fi9ke6mje2350'.
This means Hibernate failed to define relationships between the tables because the columns use different data type in Microsoft SQL Server, and since Hibernate does not enforce constraints, as it's only a mapping tool to map java objects to the database, it fails to add the constraint and outputs the error message above.
Environment
- Bamboo connected to Microsoft SQL Server 2012+
Steps to Reproduce
- Install Bamboo 5.12.
- Connect it to a Microsoft SQL Server database.
- Upgrade Bamboo to v5.14
- Start Bamboo.
- During the upgrade process Hibernate will try to map and create the relationship between tables.
Expected Results
Hibernate should create the relationship between tables as it does when using other database servers (e.g. PostgreSQL).
Actual Results
Hibernate fails to create the relationship between tables whose columns use different data types.
Reason
Bamboo 5.13 uses MSSQL2012 Dialect which maps long fields to bigint, previous dialect mapped longs to number(19, 0).
In Bamboo 5.14 new column PARENT_ID was added to VCS_LOCATION table with reference constraint to VCS_LOCATION.VCS_LOCATION_ID. PARENT_ID is bigint, VCS_LOCATION remained number(19, 0)