create table foo (id INT(10) not null ...)
Instead of declaring id as “INTEGER”, I would like to specify a length restriction as mentioned above.
I use
@Entity
class Foo {
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false)
private Integer id;
…
}
How should I specify the length restriction in my JPA model class, so that hbm2ddl automatically generates the schema as per my requirement.
In your case you are use annotaion/JPA. If you used mapping then use like this :
try this one