开发者

Unsigned Int in JPA and Hibernate

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜