Re: Run query NOT in transaction

From: Evgeny Ryabitskiy (evgeny.ryabitski..mail.com)
Date: Tue Oct 27 2009 - 12:15:47 EDT

  • Next message: Andrus Adamchik: "Re: Run query NOT in transaction"

    The problem that as usual I need to turn it off only in some "special cases".
    Usual I am using InternalTransaction API.
    Using of ProcedureQueries is not a solution in my case, we prefer
    common RowQuery. :)
    It' a solution to replace InternalTransaction by ExternalTransaction
    (which actually do nothing) in such "special cases", so it' helps.
    I just got this solution in mind. But it's not so intuitive... and
    really ugly...

    I will add issue on 3.1 Transaction mechanism is not a best part of
    Cayenne .... :(

    Evgeny.

    > 2009/10/27 Andrus Adamchik <andru..bjectstyle.org>:
    >> Yeah, quite annoying. Here is a workaround:
    >>
    >> http://cayenne.apache.org/doc20/stored-procedures-and-transactions.html
    >>
    >> Andrus
    >>
    >> On Oct 27, 2009, at 5:54 PM, Evgeny Ryabitskiy wrote:
    >>
    >>> Hello 2 everyone!
    >>>
    >>> I have one problem with transaction policy in Cayenne.
    >>> I need to run some query without transaction. Why? I am using
    >>> Temporary Tables in T-SQL which can't be created in Transaction.
    >>> But Cayenne using transaction for every query.
    >>>
    >>> Here is example:
    >>>
    >>> If I run this Query:
    >>>
    >>> Create Table #MYTempTable (someid int)
    >>> Insert Into #MYTempTable (someid) Select 0
    >>>
    >>> I got:
    >>> java.sql.SQLException: There was a transaction active when exiting
    >>> the stored procedure '****'. The temporary table '#MYTempTable' was
    >>> dropped in this transaction either explicitly or implicitly. This
    >>> transaction has been aborted to prevent database corruption.
    >>>
    >>>
    >>> After some research I didn't find any ability to  turn off transaction
    >>> for query. Maybe it will be nice to add some API parameter to change
    >>> this behavior? )
    >>>
    >>> Evgeny Ryabitskiy.
    >>>
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Tue Oct 27 2009 - 12:16:12 EDT