Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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() {     return this.stacktrace; } 
like image 264
Alex Avatar asked Jul 05 '10 13:07

Alex


People also ask

Can hibernate be used with MySQL?

Hibernate will then use MySQL's autoincremented database column to generate the primary key values.

What hibernate mapping types?

These types are “clob”, “blob”, “binary”, “text” etc. Clob and blob data types are present to maintain the data type mapping of large objects like images and videos.

What is @type in hibernate?

@Type annotation is for hibernate i.e. to tell what type of data do you want to store in database. Let's take a simple example: @Type(type="yes_no") private boolean isActive; Here return type is boolean but the value which gets stored in the database will be in Y or N format instead of true / false .

Which of the following are the two types of mapping relationship available in hibernate?

We can perform one to one mapping in hibernate by two ways: By many-to-one element. By one-to-one element.


1 Answers

Try this:

@Column(name = "STACKTRACE") @Type(type="text") 
like image 73
Maurice Perry Avatar answered Oct 01 '22 13:10

Maurice Perry