开发者

Type mapping MySQL type text to Java Hibernate

开发者 https://www.devze.com 2023-01-06 06:12 出处:网络
What is the correct mapping type from MySQL data type text to Java using Hibernate? @Column(name = \"STACKTRACE\", length = Integer.MAX_VALUE)

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

精彩评论

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

关注公众号