Dav*_*veB 40 postgresql hibernate seam hibernate-mapping seam2
我正在使用SEAM 2/Hibernate和PostgreSQL 9数据库.我有下表
Active Band
===========
active_band_id serial
active_band_user text
active_band_date timestamp
active_band_process integer
Run Code Online (Sandbox Code Playgroud)
我想添加一个约束,确保每个新条目都具有active_band_user和active_band_date的唯一组合.
每秒可能有很多尝试插入,所以我需要尽可能高效,是否有可以在实体映射中使用的SEAM/hibernate注释?
提前致谢
Mik*_*unu 79
在插入/更新之前,没有Hibernate注释检查唯一性.但是如果使用自动数据库创建,则会有注释会对数据库产生这样的约束:
@Table(
name="ACTIVE_BAND",
uniqueConstraints=
@UniqueConstraint(columnNames={"active_band_user", "active_band_date"})
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
35047 次 |
| 最近记录: |