@Lob in JPA, Hibernate

http://www.java2s.com/Tutorials/Java/JPA/0250__JPA_Lob_Column.htm



The following code shows how to save byte array to database with @Lob annotation.

LOBs have two types in the database: character large objects, called CLOBs, and binary large objects, or BLOBs.

A CLOB column holds a large character sequence, and a BLOB column can store a large byte sequence.

The Java types mapped to BLOB columns are byte[] Byte[] , and Serializable types, while char[] Character[] , and String objects are mapped to CLOB columns.

 @Lob 
  private byte[] picture;   //BLOB
or

 @Lob 
  private Byte[] picture;   //BLOB


 @Lob 
  private char[] picture;   // CLOB
or

 @Lob 
  private Character[] picture;  //CLOB

Comments

Popular posts from this blog

Fixing the DeepSpeed Import Error While Fine-Tuning the Qwen Model

Amazon Linux 2023 - User data configuration for launch templates to connect to the EKS cluster

How to create ISM policy and rotate logs in opensearch