make the section on @Lob even more explicit

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-04-25 15:55:39 +02:00
parent 2202487633
commit fd2e1aca81
1 changed files with 15 additions and 0 deletions

View File

@ -648,6 +648,21 @@ So unless you specifically need to use these JDBC LOB APIs, you _don't_ need the
Instead, as we just saw in <<column-lengths>>, all you need is to specify a large enough column `length` to accommodate the data you plan to write to that column.
You should usually write this:
[source,java]
----
@Column(length=LONG32) // good, correct column type inferred
String text;
----
instead of this:
[source,java]
----
@Lob // almost always unnecessary
String text;
----
This is particularly true for PostgreSQL.
[%unbreakable]
[WARNING]
// .PostgreSQL `BYTEA` and `TEXT`