Reputation: 36210
I want to store user's reports. The database is autogenerated by Hibernate based on the Java entities.
What is the best way to specify, that the String report
will contain a large portion of information?
The options are:
@Column(length = xxxx) - this looks like more portable
@Column(columnDefinition = "TEXT") - doesn't work on some databases
@Lob - not sure what are pros/cons
Any suggestions?
Upvotes: 0
Views: 100
Reputation: 22296
The advantage of using @Column(length = xxxx)
is their portability. If you know you're not changing the database, you can use the second option and check for a native Type.
Otherwise use the first option. The @Lob
could lead to problems if you need to search the text inside the field, because it can be considered as binary.
Upvotes: 1