开发者

Type mapping MySQL type text to Java Hibernate

What is the correct mapping type from MySQL data type text to Java using Hibernate?

@Column(name = "STACKTRACE", length = Integer.MAX_VALUE)
public String getStacktrace() {
    retur开发者_运维百科n this.stacktrace;
}


Try this:

@Column(name = "STACKTRACE")
@Type(type="text")


I think this solves the problem

@Column(length = 65535,columnDefinition="Text")


The reverse engineering Hibernate Tools, makes from MySql Type text:

@Column(name = "COLUMNNAME", length = 65535)


To fix this issue, I had to annotate like below:

@Column(name="LONG_DESCRIPTION" , length = 65535, columnDefinition="TEXT")
@Type(type="text")'
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜