hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

HHH-14725 Fix reset handling on BlobProxy

Open Naros opened this issue 2 years ago • 5 comments

https://hibernate.atlassian.net/browse/HHH-14725

Naros avatar Dec 19 '21 04:12 Naros

How about wrapping an InputStream to make sure closing only happens at the end of a TX when we do resource cleanup in Hibernate? If we see that the InputStream doesn't support marking, we could read the contents first into a byte[] and then serve data from there, or alternatively, write into a temporary file and serve data from that.

beikov avatar Dec 20 '21 09:12 beikov

Is there maybe an ETA when this will be merged? We have encountered an issue with exactly this problem recently.

Our workaround for now is: We refresh the Entity with the Blob using the EntityManager before operating on the Blob's InputStream/Bytes.

Another workaround is to use a Session and get the Entity with the Blob from the Session and then operate on the InputStream / bytes[].

oppahansi avatar Feb 20 '24 07:02 oppahansi

How about wrapping an InputStream to make sure closing only happens at the end of a TX when we do resource cleanup in Hibernate? If we see that the InputStream doesn't support marking, we could read the contents first into a byte[] and then serve data from there, or alternatively, write into a temporary file and serve data from that.

Hi @beikov do we have another proxy type that does this so I can use that as a reference guide?

Naros avatar Mar 10 '24 23:03 Naros

It's fine, let's merge this as soon as tests succeed.

beikov avatar Mar 27 '24 15:03 beikov

The test seems to fail @Naros

beikov avatar Mar 27 '24 17:03 beikov