Playframework Play framework 2.1.1,@ElementCollection未在evolution中生成
我有一个简单的模型,如下所示:Playframework Play framework 2.1.1,@ElementCollection未在evolution中生成,playframework,playframework-2.1,ebean,Playframework,Playframework 2.1,Ebean,我有一个简单的模型,如下所示: @Entity public class Album extends Model { @Id public Long id; public String name; @ElementCollection public Set<String> urls = new HashSet<>(); // ... } # --- Created by Ebean DDL # To stop Ebea
@Entity
public class Album extends Model {
@Id
public Long id;
public String name;
@ElementCollection
public Set<String> urls = new HashSet<>();
// ...
}
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table album (
id bigint not null,
name varchar(255),
constraint pk_album primary key (id))
;
create sequence album_seq;
我错过了什么?我有没有其他的方式来建立这种关系
编辑:我正在通过添加一个Url实体并将@manytone映射放回相册来快速完成这项工作,但这真的不太好…EBean似乎不支持@ElementCollection
一种方法应该是将URL集声明为@Transient(即非持久化),并有方法来管理它,同时保持包含逗号分隔标记的简单字符串的最新状态。这将是一个字符串,它将被保存在一列中。谢谢eskatos。我应该回到这里,这是在EBean(2012年起)中对此的功能要求:。我最终在url中存储了更多的细节,所以我的许多工作都对我有用,但我还是会投票给你:)