Search code examples
hibernateforeign-keysibm-clouddashdb

DashDB - Problems to generate foreign key with Hibernate


I am using the dashDB database service of IBM Bluemix to create a cloud application. Well, when I run my app, as hibernate hbm2ddl.auto property is set to update, it will update my dashDB base.

However, the following error appears on the console:

[ERROR ] HHH000388: Unsuccessful: alter table DASH104411.table1 add constraint 
FK_m1vvn3lavq1rjt9oghf0m3x5t foreign key (id_table2) references DASH104411.table2
[ERROR ] DB2 SQL Error: SQLCODE=-1667, SQLSTATE=42858, SQLERRMC=DASH104411.TABLE2;
ORGANIZE BY COLUMN;ENFORCED, DRIVER=4.19.49

I know that, by default, the tables created for dashDB are organized by column and only non-enforced referential constraints are supported. So how do I generate foreign keys that are not enforced by hibernate? Is there a way to generate tables that are organized by row by hibernate?


Solution

  • Not aware of a mechanism to have Hibernate generate the create table DDL with the 'organize_by_row' clause. You probably want to use the SQLDB service. See this earlier post - https://developer.ibm.com/answers/questions/21252/how-to-use-ruby-on-rails-with-analytics-warehouse-service-blu-acceleration-on-bluemix.html