Unique constraint not created in JPA

后端 未结 5 1470
抹茶落季
抹茶落季 2021-01-18 01:49

I have created the following entity bean, and specified two columns as being unique. Now my problem is that the table is created without the unique constraint, and no errors

5条回答
  •  盖世英雄少女心
    2021-01-18 02:51

    If you want the unique constraint, you should do it by sql:

    ALTER TABLE cm_blockList ADD CONSTRAINT cm_blockList_unq UNIQUE (terminal);
    

    See also: https://stackoverflow.com/a/3498242/1244488

提交回复
热议问题