[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-2680) Blobs not updated on Session.merge() for detached instances

Vladimir Korolev (JIRA) noreply at atlassian.com
Tue Jun 8 07:44:17 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2680?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vladimir Korolev updated HHH-2680:
----------------------------------

    Attachment: FileBlob.java
                FixedBlobType.java

Hibernate custom types can be used to solve this problem. See attached FixedBlobType.java.
You should only replace @Lob with declaration of your type. So typical reference to a blob will be like this:

@Type(type = "com.texunatech.hibernate.type.FixedBlobType")
@Basic(fetch = FetchType.LAZY)
private Blob data;

Also I'm not sure about usage of Hibernate.createBlob() for copying. In my test use case this worked. But in general this may lead to errors because blob in merged entity depends on blob in detached entity. I stopped on copying blob's content to a file and returning new SerializableBlob(new FileBlob(file)), where FileBlob is in attached file. This also solved a problem with several reads from one blob.

> Blobs not updated on Session.merge() for detached instances
> -----------------------------------------------------------
>
>                 Key: HHH-2680
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2680
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.2, 3.2.4.sp1
>         Environment: Windows XP Prof., Java 1.5_010, HSQLDB 1.8.0
>            Reporter: Timo Thomas
>         Attachments: blobmerge.patch, BlobTest.zip, FileBlob.java, FixedBlobType.java
>
>
> Blob columns are not updated when a detached instance is saved at the session with merge(). See attached TestCase.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list