You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Markus Fuchs <Ma...@Sun.COM> on 2007/06/08 01:52:34 UTC

Two questions about OpenJPA impl.

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.

Re: Two questions about OpenJPA impl.

Posted by Markus Fuchs <Ma...@Sun.COM>.
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 <Ma...@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.
>>
>
>

Re: Two questions about OpenJPA impl.

Posted by Patrick Linskey <pl...@gmail.com>.
> 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?

> 3) Can foreign keys be used in the WHERE clause for updates/deletes?

Yes -- what type of query are you looking for in particular?

-Patrick

On 6/7/07, Markus Fuchs <Ma...@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.
>


-- 
Patrick Linskey
202 669 5907