playframework - JPA & Ebean DDL,使用@ElementCollection 注解时如何正确生成id?
问题描述
我使用 Ebean 作为我的带有 Play Framework 的 ORM。在我的一些模型中,我使用了@ElementCollection
注释。
@ElementCollection
@CollectionTable(name = "tags", joinColumns = @JoinColumn(name = "id"))
@Column(name="tag")
public List<String> tags;
我的问题是,当 Ebean DDL 生成 SQL DDL 来定义我们的表时,使用@ElementCollection
注释创建的表使用bigint
类型作为其 id 而不是bigserial
.
而不是生成,
create table foo (
id bigint not null
...
);
应生成以下内容,
create table foo (
id bigserial not null
...
);
如何确保所有 id 都是 bigserials?根据我的理解和文档bigint 是无符号的,而不是自动递增的。
解决方案
推荐阅读
- r - Mac OS 11.2.1 Big sur-git 版本控制 Rstudio 路径 - 无法编辑。无法链接
- mysql - 如何避免 GORM 中的竞争条件
- sql - 使用唯一的整数数组更新 postgres 表
- c++ - 为什么我不能返回对使用模板创建的派生类的 unique_ptr 的引用?
- java - 将代码提取到方法中时java会更快吗?(国际象棋引擎)
- javascript - 将罗马数字转换为阿拉伯数字——recursiv
- javascript - 带有 jQuery 的 Django 模板“包含”标签
- c# - ActivatorUtilities 是否支持生命周期?
- json - Json 身体转换为密封特性
- python - Discord.py - 角色前缀系统