views:

517

answers:

1

I have the following mapping

@Entity
@SequenceGenerator(name="sacpSequenceGenerator", sequenceName="SACP_SEQ")
public class Sacp {

    private Integer id;


    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sacpSequenceGenerator")
    public Integer getId() {
        return this.id;
    }

    // other setter's and getter's
}

SACP Table is mapped according to

ID NUT NULL NUMBER(4)

When i try to save a Sacp instance, Hibernate complains

ORA-01438: Value larger than specified precision allows for this column

Even when using a Long instead of Integer, same error is thrown

What should i do to fix it ?

+1  A: 

I have found this

SEQ_GEN defines a sequence generator using a sequence named my_sequence. The allocation size used for this sequence based hilo algorithm is 20. Note that this version of Hibernate Annotations does not handle initialValue in the sequence generator. The default allocation size is 50, so if you want to use a sequence and pickup the value each time, you must set the allocation size to 1.

And now it works fine

Arthur Ronald F D Garcia