簡體   English   中英

數據庫模式不符合休眠注釋

[英]Database schema not as per hibernate annotations

我正在使用休眠來創建實體。 我使用的屬性如下:

@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)
)

我無法找出如何phone_no屬性被轉換成19的尺寸和customer_id到10?

根據JPA,長度僅適用於字符串類型。 類型“ int”控制CUSTOMER_ID的存儲大小。 輸入“ Long”控制PHONE_NO的存儲大小。

您是否真的想要電話號碼是長號? 更好的字符串?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM