简体   繁体   中英

Long column size in JPA/Hibernate

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = COMPANY_ID , length = 10)
private Long id;

在此处输入图片说明

in my sql it gets converted to BIGINT(20),what if i want it to be int(11) or how to give specific size to Long field??

您可以在@Column()中使用columnDefinition

 @Column(columnDefinition="BIGINT(20)")

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM