How to set up precision attribute used by @Collumn annotation ???

Posted by Arthur Ronald F D Garcia on Stack Overflow See other posts from Stack Overflow or by Arthur Ronald F D Garcia
Published on 2010-05-26T21:10:34Z Indexed on 2010/05/26 21:11 UTC
Read the original article Hit count: 236

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 ?

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate