Re: Error executing SQL from Entity Modeler

From: Pierre Frisch (pierre.frisc..pearway.com)
Date: Thu Aug 31 2006 - 01:08:23 EDT

  • Next message: womai..ac.com: "Re: Error executing SQL from Entity Modeler"

    This is kind of a FrontBase thing, it really is part of the sql92
    standard but some database don't respect it.

    I had that problem a long time ago and I am trying to remember what I
    did to fix it. If I remember correctly the session transaction
    parameters can only be set on a new channel. Here is the code that I
    use for my apps.

    Pierre

         public boolean evaluateExpressionList(NSArray anExpressionList,
    EODatabaseContext databaseContext) {
                    if ( (anExpressionList == null) || (anExpressionList.count() == 0))
    return true;
             EOAdaptorChannel anAdaptorChannel = null;
             boolean result = true;
             try {
                 anAdaptorChannel = databaseContext.adaptorContext
    ().createAdaptorChannel();
                 if (anAdaptorChannel != null) {
                     if ( ! anAdaptorChannel.isOpen() )
    anAdaptorChannel.openChannel();
                     for (Enumeration enumerator =
    anExpressionList.objectEnumerator(); enumerator.hasMoreElements(); ) {
                         result = this.evaluateExpression
    ( (EOSQLExpression)enumerator.nextElement(), anAdaptorChannel ) &&
    result;
                     }
                 }
             } catch (Exception exception) {
                 if (logger.isEnabledFor(org.apache.log4j.Level.ERROR)) {
                     logger.error("evaluateExpressionList(): " , exception);
                 }
             } finally {
                 if ( (anAdaptorChannel != null) &&
    anAdaptorChannel.isOpen() ) anAdaptorChannel.closeChannel();
             }
             return result;
         }

         public boolean evaluateExpression(EOSQLExpression anExpression,
    EOAdaptorChannel anAdaptorChannel) {
             boolean result = false;
             try {
                 if (anAdaptorChannel != null) {
                     if ( ! anAdaptorChannel.isOpen() )
    anAdaptorChannel.openChannel();
                     anAdaptorChannel.evaluateExpression( anExpression );
                 }
                 result = true;
             } catch (Exception exception) {
                 if (logger.isEnabledFor(org.apache.log4j.Level.ERROR)) {
                     logger.error("evaluateExpression(): " , exception);
                 }
             }
             return result;
         }

    On 30-Aug-06, at 9:43 PM, Chuck Hill wrote:

    > This is probably a FrontBase thing. The statement
    >>> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, LOCKING PESSIMISTIC;
    > only applies until the next commit. After that you need to issue
    > it again. You may be able to do this on the connection instead of
    > in the script. I don't know, I always use scripts.
    >
    > Could that be the problem?
    >
    > Chuck
    >
    >
    >
    > On Aug 30, 2006, at 8:10 PM, Mike Schrag wrote:
    >
    >> This is almost certainly because split on ;'s and execute each
    >> line independently. Anyone know how EOModeler-proper might do
    >> this and also have the ability to trap the failed delete table
    >> statements like it does?
    >
    > I'd guess that it is committing after each one.
    >
    > Chuck
    >
    >>
    >> ms
    >>
    >> On Aug 30, 2006, at 9:20 PM, womai..ac.com wrote:
    >>
    >>> When I execute the SQL generated by Entity Modeler I get the
    >>> following error:
    >>>
    >>> java.sql.SQLException: Exception condition 384. Transaction
    >>> MUST be SERIALIZABLE, PESSIMISTIC. Do you want to cancel the
    >>> rest of the script?
    >>>
    >>> The first line of the generated SQL is
    >>>
    >>> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, LOCKING PESSIMISTIC;
    >>>
    >>> I don't see any way to influence the SQL that's generated, and I
    >>> can't edit it. I have run it from FrontBase Manager and it
    >>> doesn't generate any errors there.
    >>>
    >>> So what can I do to fix this?
    >>>
    >>> thanks,
    >>>
    >>> janine
    >>>
    >>
    >
    > --
    >
    > Practical WebObjects - for developers who want to increase their
    > overall knowledge of WebObjects or who are trying to solve specific
    > problems. http://www.global-village.net/products/
    > practical_webobjects
    >
    >
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Aug 31 2006 - 01:08:37 EDT