How to use mysql compress () / uncompress () with hibernate?

How to use mysql compress () and uncompress () functions to compress text before i save it and unzip it when i extract it using mysql database with sleep mode for ORM?

+3
source share
3 answers

See ColumnTransformer , IIRC with 3.6:

@Column(name = "data", columnDefinition = "BLOB", nullable = false)
@ColumnTransformer(read = "UNCOMPRESS(data)", write = "COMPRESS(?)")
@Lob
public byte[] getData()
{
    return theData;
}
+4
source

hmm own requests ? But I should not tell you that your application will depend on mysql rdbms then;)

+1
source

. hibernate. , .

0
source

Source: https://habr.com/ru/post/1748536/


All Articles