3

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 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

You should not change the default allocation size : itdevworld.wordpress.com/2009/12/20/… See also stackoverflow.com/questions/2155376/… for a valid example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.