I often use java.lang.Integer as the primary key. Here you can see the code snippet
@Entity
private class Person {
private Integer id;
@Id
@Column(precision=8, nullable=false)
public Integer getId() {
}
}
I need to set its precision attribute value to 8 . But when exporting a schema (Oracle), it does not work as expected.
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 output
create table Person (id number(10,0) not null)
I always get 10 . Is there a workaround to get 8 instead of 10?
source
share