How to set up precision attribute used by @Collumn annotation ???
- by Arthur Ronald F D Garcia
I often use java.lang.Integer as primary key. Here you can see some piece of code
@Entity
private class Person {
private Integer id;
@Id
@Column(precision=8, nullable=false)
public Integer getId() {
}
}
I need to set up its precision attribute value equal to 8. But, when exporting The 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 outputs
create table Person (id number(10,0) not null)
Always i get 10. Is There some workaround to get 8 instead of 10 ?