Skip to content

Instantly share code, notes, and snippets.

View rifttech's full-sized avatar
🐳
Focusing

Arthur Abramov rifttech

🐳
Focusing
View GitHub Profile
@rifttech
rifttech / hibernate-jpa-postgres-issues.md
Created June 10, 2021 06:34 — forked from vegaasen/hibernate-jpa-postgres-issues.md
BLOBs with Postgres and Hibernate caused a lot of headace for me

The problem

It seems like mapping a LOB-type from Hibernate is not as easy as you'd think. If you're like me, you'll toss something like the following annotation to a POJO and hoping that all is fine:

@Lob
@Column(name = "picture")
private byte[] picture;

However, lo and behold - things is not as expected. Hibernate throws all kinds of fancy exceptions - such as:

public class BlockingQueue implements Queue {
private java.util.Queue queue = new java.util.LinkedList();
/**
* Make a blocking Dequeue call so that we'll only return when the queue has
* something on it, otherwise we'll wait until something is put on it.
*
* @returns This will return null if the thread wait() call is interrupted.
*/