Java 增加@ElementCollection中元素的大小
我在JPA中有一个Java 增加@ElementCollection中元素的大小,java,mysql,hibernate,jpa,h2,Java,Mysql,Hibernate,Jpa,H2,我在JPA中有一个@Entity,它有一个@ElementCollection,如下所示: @ElementCollection(fetch=FetchType.EAGER) List<String> photodescription = new ArrayList<>(); @ElementCollection(fetch=FetchType.EAGER) List photodescription=new ArrayList(); 问题是,默认情况下,任何phot
@Entity
,它有一个@ElementCollection
,如下所示:
@ElementCollection(fetch=FetchType.EAGER)
List<String> photodescription = new ArrayList<>();
@ElementCollection(fetch=FetchType.EAGER)
List photodescription=new ArrayList();
问题是,默认情况下,任何photodescription
的列都是VARCHAR(255)
。
我需要增加到10000
为@ElementCollection
中的元素存在任何注释,以设置用于简单字符串的最大大小,如@size(max=1000)
。注释仍应适用于此字符串集合:
@ElementCollection(fetch=FetchType.EAGER)
@Column(length=10000) // OR @Column(columnDefinition="VARCHAR(10000)")
List<String> photodescription = new ArrayList<>();
@ElementCollection(fetch=FetchType.EAGER)
@列(长度=10000)//或@Column(columnDefinition=“VARCHAR(10000)”)
List photodescription=new ArrayList();