Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 单列唯一约束的注释_Hibernate_Jpa_Hibernate Annotations - Fatal编程技术网

Hibernate 单列唯一约束的注释

Hibernate 单列唯一约束的注释,hibernate,jpa,hibernate-annotations,Hibernate,Jpa,Hibernate Annotations,我想指示Hibernate在单个列上创建唯一约束。我已经在hibernate配置中设置了hibernate.hbm2ddl.auto=update,我的代码如下所示: @Column(name = "program_id",unique=true) @Length(min = 0, max = 10) private String programID; 在MySQL中,我没有看到在表上创建任何唯一索引。我该怎么做才能让它工作?什么是底层数据库系统?您是否尝试过插入具有相同程序ID的实体?是的,

我想指示Hibernate在单个列上创建唯一约束。我已经在hibernate配置中设置了
hibernate.hbm2ddl.auto=update
,我的代码如下所示:

@Column(name = "program_id",unique=true)
@Length(min = 0, max = 10)
private String programID;

在MySQL中,我没有看到在表上创建任何唯一索引。我该怎么做才能让它工作?

什么是底层数据库系统?您是否尝试过插入具有相同程序ID的实体?是的,我尝试过。它很好地放在桌子上。