Filip Spiridonov
Filip Spiridonov

Reputation: 36210

Generate large length column using Hibernate

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:

Any suggestions?

Upvotes: 0

Views: 100

Answers (1)

Paulo Fidalgo
Paulo Fidalgo

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

Related Questions