Hi,

I suggest to use PreparedStatement, and always create a new
PreparedStatement (for each invokation of the trigger).

Internally, the database caches a low-level part of a PreparedStatement, so
that creating the PreparedStatement should be fast. This is the "query
cache", see also
http://h2database.com/javadoc/org/h2/constant/DbSettings.html#QUERY_CACHE_SIZE-
the documentation is actually wrong, as it doesn't just cache "select"
statements as it used to, but also "delete", "insert", "update". I have
updated the documentation:
https://code.google.com/p/h2database/source/detail?r=4829

Regards,
Thomas



On Mon, May 27, 2013 at 10:14 PM, Gili <[email protected]> wrote:

> So to follow-up on http://stackoverflow.com/q/16705097/14731, are
> triggers the only way to go? Or is there a better way to implement this?
>
> Thank you,
> Gil
>
> On Thursday, May 23, 2013 8:17:30 PM UTC-4, Gili wrote:
>
>> Hi,
>>
>> Based on the third answer at https://groups.google.com/**
>> forum/#!msg/h2-database/**VoE3AU7mSuM/YAReMtnRsZQJ<https://groups.google.com/forum/#!msg/h2-database/VoE3AU7mSuM/YAReMtnRsZQJ>
>>  I
>> am expecting a AFTER DELETE Trigger to get the same Connection as the
>> statement that executed the DELETE operation, but it does not. I am seeing
>> two separate connections and if they attempt to write to the same table the
>> operation deadlocks.
>>
>> Did this behavior change since June 2010 (when linked post was made)? Are
>> trigger supposed to get the same connection as the original operation? If
>> not, is it possible to configure them to do so?
>>
>> I ask because I'm still trying to solve this question: http://**
>> stackoverflow.com/q/16705097/**14731<http://stackoverflow.com/q/16705097/14731>
>>
>> Thanks,
>> Gili
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to