db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kristian Waagan (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3650) Derby + Hibernate JPA 3.2.1 problem on entity with Blob/Clob
Date Wed, 30 Apr 2008 18:26:55 GMT

     [ https://issues.apache.org/jira/browse/DERBY-3650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Kristian Waagan updated DERBY-3650:

    Attachment: testdb.zip

My early suspicions pointed at the new release mechanism to avoid LOB locators piling up in
the server, eventually leading to an OOME before the problem was fix.
Following this trail led me to the cause of the bug. 

When a new Clob is created,  a store stream that has already been closed is passed in to the
EmbedClob constructor.
The stream has been closed by EmbedClob.free (the Clob being represented as a StoreStreamClob).
Derby fails at EmbedClob:153, more specifically in OverflowInputStream:155. Here it detects
that there is no active transaction, which indicates a commit or rollback has taken place.
However, I think that is a red herring.

Further investigation made it clear that in the case of the data generation script in the
original repro, you need childrenCout to be 19 (or higher) to provoke the error.
Making the original join query less verbose, gives:
    Tbl_T4 inner join Tbl_T2 on Tbl_T4.Id_T2=Tbl_T2.Id
                        left outer join Tbl_T1 on Tbl_T2.Id_T1=Tbl_T1.Id
WHERE Tbl_T4.Id_T3=?

If you allow the LOB release mechanism to release a Clob, the bug occurs because all rows
in the result set points to the same Clob data.
I made a smaller repro, you have to run the original one first to create the data or download
the zipped db. Feel free to improve it, I was a bit short on time to extract the data generation
and add proper comments...

The question is, where and how should this problem be fixed?

> Derby + Hibernate JPA 3.2.1 problem on entity with Blob/Clob
> ------------------------------------------------------------
>                 Key: DERBY-3650
>                 URL: https://issues.apache.org/jira/browse/DERBY-3650
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions:
>         Environment: Mac OSX 10.4
> JDK 1.5.0_13
> Hibernate EntityManager 3.2.1
>            Reporter: Golgoth 14
>         Attachments: Derby3650Repro.java, DerbyHibernateTest.zip, testdb.zip
> Hi,
> I'm using Derby in Client - Server mode with Hibernate JPA EJB 3.0.
> When a query on an entity containing a Clob and some joins on other entites is executed,
an exception with the following message is thrown:
>   XJ073: The data in this BLOB or CLOB is no longer available.  The BLOB/CLOB's transaction
may be committed, or its connection is closed.
> This problem occurs when the property "hibernate.max_fetch_depth" is greater than 0.
> When hibernate.max_fetch_depth=0, the query works.
> If Derby is configured in embedded mode, the query works independently of the value of
> On the Hibernate's documentation, the advised value of hibernate.max_fetch_depth is 3.
> Could you explain me if I made something wrong ?
> Thank you.
> Stephane

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message