Inside my enitity I defined a field:
@Enumerated(EnumType.STRING)
private TaskStatus status;
This field has enum type:
public enum TaskStatus {
NEW, IN_PROGRESS, DONE
}
Inside my table this column has character varying(255)
type. Is it possible to automatically limit this length using Hibernate or do I have to manually set @Size
for this ?
只需将注释@Column(length = 11)
到status
属性(具有最大枚举的长度)。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.