openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Fuchs <Markus.Fu...@Sun.COM>
Subject Re: Two questions about OpenJPA impl.
Date Fri, 08 Jun 2007 21:10:44 GMT
Hi Patrick and Reece,

Thanks for your answers. I should have been more clear in my questions.

Patrick Linskey wrote:
>> 1) Does OpenJPA create before images for rollback? Or is the transaction
>> rollback functionality just implemented in the JDO closed source? As
>> Reece mentions, we'd need before image values on relationships for
>> dependency calculation in case of unique keys.
>
> OpenJPA can do that, yes. You need to configure things accordingly,
> but the feature is definitely there. See the RetainValues property.
>
>> 2) Why are updates ignored (not re-ordered) in ConstraintUpdateManager,
>> if there are *no* delete-then-insert-same-pk?
>
> The graph is walked, which will potentially re-order the updates. What
> bit of code are you referring to?
>
In ConstraintUpdateManager#analyzeForeignKeys line 157, there is this 
boolean flag ignoreUpdates. Maybe it's just the name that confuses me, 
but why are updates re-ordered if there are delete-then-insert-same-pk, 
and otherwise not? I.e. what requires updates to be considered in the 
delete-then-insert-same-pk case? Also, if ignoreUpdate is true in line 
188, the updates would be executed in random order, correct?
>> 3) Can foreign keys be used in the WHERE clause for updates/deletes?
>
> Yes -- what type of query are you looking for in particular?
>
I was wondering about lines like

            sm = row.getForeignKeySet(fks[i]);
            if (sm == null)
                sm = row.getForeignKeyWhere(fks[i]);

Do "-Set" and "-Where" mean the SET and WHERE clause of a SQL (UPDATE) 
statement? What are the values in ForeignKeyWhere? Aren't these before 
image values? Also, I expect updates to be done referencing pk columns 
only, like WHERE pk1 = ?, ..., pkN = ?

Thanks again,

-- markus.
> -Patrick
>
> On 6/7/07, Markus Fuchs <Markus.Fuchs@sun.com> wrote:
>> Hi all,
>>
>> could somebody please answer these questions?
>>
>> 1) Does OpenJPA create before images for rollback? Or is the transaction
>> rollback functionality just implemented in the JDO closed source? As
>> Reece mentions, we'd need before image values on relationships for
>> dependency calculation in case of unique keys.
>>
>> 2) Why are updates ignored (not re-ordered) in ConstraintUpdateManager,
>> if there are *no* delete-then-insert-same-pk?
>>
>> 3) Can foreign keys be used in the WHERE clause for updates/deletes?
>>
>> Thanks so much!
>>
>> -- markus.
>>
>
>

Mime
View raw message