开发者

Unsigned Int in JPA and Hibernate

开发者 https://www.devze.com 2023-02-15 20:40 出处:网络
What can i do so JPA (i use Hibernate) creates Columns with Unsigned types? Currently all开发者_开发技巧 my ID columns are signed.Using the columnDefinition property on the @Column annotation should d

What can i do so JPA (i use Hibernate) creates Columns with Unsigned types? Currently all开发者_开发技巧 my ID columns are signed.


Using the columnDefinition property on the @Column annotation should do it. Taking a total guess at the SQL type you're going for:

private long foo;

@Column(columnDefinition = "UNSIGNED INT(11)")
public long getFoo()
{
    return foo;
}

N.B. Not all databases (like SQL Server, I think) support unsigned int types.


In MySQL Workbench "UNSIGNED" should come after "INT(11)"

0

精彩评论

暂无评论...
验证码 换一张
取 消