数据库模式不是根据hibernate注释

时间:2016-01-03 05:49:56

标签: java hibernate

我正在使用hibernate来创建实体。我使用的属性如下:

$(".grid-item").not('.new').addClass('visible');

但是,我可以通过日志看到创建的表格如下:

@Id
@SequenceGenerator(name = "customer-id-gen", sequenceName = "CUSTOMERS_SEQ", allocationSize = 1)
@GeneratedValue(generator = "customer-id-gen", strategy = GenerationType.SEQUENCE)
@Column(name = "CUSTOMER_ID", length = 4, nullable = false)
private int customerId;

@Column(name = "CUSTOMER_NAME", length = 40, unique = false, nullable = false)
private String customerName;

@Column(name = "PHONE_NO", unique = true, nullable = true, length = 10)
private Long phoneNo;

我无法弄清create table CUSTOMER_ALL ( CUSTOMER_ID number(10,0) not null, CUSTOMER_NAME varchar2(40 char) not null, PHONE_NO number(19,0) unique, primary key (CUSTOMER_ID) ) 属性如何转换为19大小和phone_no到10?

1 个答案:

答案 0 :(得分:1)

根据JPA,长度仅适用于String类型。 输入' int'控制CUSTOMER_ID的存储大小。 键入' Long'控制PHONE_NO的存储大小。

你真的想要一个电话号码吗?更好的字符串?