나는 주로 java.lang.Integer를 기본 키로 사용한다. 여기에 내가 8 동일한 정밀도 속성 값 을 설정해야합니다 코드@Column 주석에서 사용하는 정밀도 속성을 설정하는 방법은 무엇입니까?
@Entity
private class Person {
private Integer id;
@Id
@Column(precision=8, nullable=false)
public Integer getId() {
}
}
의 일부 조각을 볼 수 있습니다. 그러나 스키마 (Oracle)를 내보낼 때 예상대로 작동하지 않습니다.
AnnotationConfiguration configuration = new AnnotationConfiguration();
configuration
.addAnnotatedClass(Person.class)
.setProperty(Environment.DIALECT, "org.hibernate.dialect.OracleDialect")
.setProperty(Environment.DRIVER, "oracle.jdbc.driver.OracleDriver");
SchemaExport schema = new SchemaExport(configuration);
schema.setOutputFile("schema.sql");
schema.create(true, false);
schema.sql 출력
create table Person (id number(10,0) not null)
항상 전 10을 얻는다. 10 대신 8을 얻는 몇 가지 해결 방법이 있습니까?
(+1)하지만 난 누구의 정밀도가 10보다 큰 인 BigInteger이있는 경우, 그것을 작동합니다. 나는 왜 이해하지 못한다 –
정말 놀랍지도 않다. Hibernate가 JPA1 스펙에 의해 엄격하게 정의되거나 잘 정의되지 않은 경우 라하더라도 "당신이 의미하는대로 작동"하는 유일한 곳이되지는 않을 것입니다. – Affe