-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MySQL Dialect Bulk Delete/Edit
PostPosted: Wed Apr 09, 2008 4:57 am 
Newbie

Joined: Wed Apr 09, 2008 4:19 am
Posts: 3
Hello,

Does Hibernate support Temp Table wrapping for MySQL Bulk/Delete queries?

EJB QL:
Code:
DELETE AlertConditionLog acl
    WHERE acl.id IN
        ( SELECT iacl.id
               FROM AlertConditionLog iacl
               WHERE iacl.condition.alertDefinition.resource.id = :resourceId )


SQL Exception:
Code:
You can't specify target table 'RHQ_ALERT_CONDITION_LOG' for update in FROM clause


From MySQL doc
Quote:
In general, you cannot modify a table and select from the same table in a subquery. For example, this limitation applies to statements of the following forms:

DELETE FROM t WHERE ... (SELECT ... FROM t ...);
UPDATE t ... WHERE col = (SELECT ... FROM t ...);
{INSERT|REPLACE} INTO t (SELECT ... FROM t ...);

Exception: The preceding prohibition does not apply if you are using a subquery for the modified table in the FROM clause. Example:

UPDATE t ... WHERE col = (SELECT (SELECT ... FROM t...) AS _t ...);

Here the prohibition does not apply because the result from a subquery in the FROM clause is stored as a temporary table, so the relevant rows in t have already been selected by the time the update to t takes place.

http://dev.mysql.com/doc/refman/5.0/en/subquery-restrictions.html

I saw in Hibernate sources/docs have some info in Dialect/MySQLDialect
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/dialect/MySQLDialect.html#supportsSubqueryOnMutatingTable()

SQL:
Code:
delete
from
    RHQ_ALERT_CONDITION_LOG
where
    ID in (
        select
            alertcondi1_.ID
        from
            RHQ_ALERT_CONDITION_LOG alertcondi1_,
            RHQ_ALERT_CONDITION alertcondi2_,
            RHQ_ALERT_DEFINITION alertdefin3_
        where
            alertcondi1_.CONDITION_ID=alertcondi2_.ID
            and alertcondi2_.ALERT_DEFINITION_ID=alertdefin3_.ID
            and alertdefin3_.RESOURCE_ID=1
    )


gives error in MySQL
Code:
You can't specify target table 'RHQ_ALERT_CONDITION_LOG' for update in FROM clause


but SQL:
Code:
delete
from
    RHQ_ALERT_CONDITION_LOG
where
    ID in (
        select * from (
            select
                alertcondi1_.ID
            from
                RHQ_ALERT_CONDITION_LOG alertcondi1_,
                RHQ_ALERT_CONDITION alertcondi2_,
                RHQ_ALERT_DEFINITION alertdefin3_
            where
                alertcondi1_.CONDITION_ID=alertcondi2_.ID
                and alertcondi2_.ALERT_DEFINITION_ID=alertdefin3_.ID
                and alertdefin3_.RESOURCE_ID=1
        ) as _t
    )

could be executed Ok


hibernate-3.2.x
hibernate-annotations-3.2.1.GA
hibernate-entitymanager-3.2.1.GA
MySQL 5.0.22


Hibernate Logs
Code:
DEBUG 08-04 10:48:19,031 (AbstractEntityManagerImpl.java:joinTransaction:450)  -Looking for a JTA transaction to join
DEBUG 08-04 10:48:19,031 (JDBCContext.java:registerSynchronizationIfPossible:172)  -successfully registered Synchronization
DEBUG 08-04 10:48:19,046 (AbstractEntityManagerImpl.java:joinTransaction:450)  -Looking for a JTA transaction to join
DEBUG 08-04 10:48:19,046 (AbstractEntityManagerImpl.java:joinTransaction:458)  -Transaction already joined
DEBUG 08-04 10:48:19,078 (QueryTranslatorImpl.java:parse:246)  -parse() - HQL: DELETE org.rhq.core.domain.alert.AlertConditionLog acl WHERE acl.id IN ( SELECT iacl.id FROM org.rhq.core.domain.alert.AlertConditionLog iacl WHERE iacl.condition.alertDefinition.resource.id = :resourceId )
DEBUG 08-04 10:48:19,093 (QueryTranslatorImpl.java:showHqlAst:266)  ---- HQL AST ---
\-[DELETE] 'DELETE'
    +-[FROM] 'FROM'
    |  \-[RANGE] 'RANGE'
    |     +-[DOT] '.'
    |     |  +-[DOT] '.'
    |     |  |  +-[DOT] '.'
    |     |  |  |  +-[DOT] '.'
    |     |  |  |  |  +-[DOT] '.'
    |     |  |  |  |  |  +-[IDENT] 'org'
    |     |  |  |  |  |  \-[IDENT] 'rhq'
    |     |  |  |  |  \-[IDENT] 'core'
    |     |  |  |  \-[IDENT] 'domain'
    |     |  |  \-[IDENT] 'alert'
    |     |  \-[IDENT] 'AlertConditionLog'
    |     \-[ALIAS] 'acl'
    \-[WHERE] 'WHERE'
       \-[IN] 'in'
          +-[DOT] '.'
          |  +-[IDENT] 'acl'
          |  \-[IDENT] 'id'
          \-[IN_LIST] 'inList'
             \-[QUERY] 'query'
                +-[SELECT_FROM] 'SELECT_FROM'
                |  +-[FROM] 'FROM'
                |  |  \-[RANGE] 'RANGE'
                |  |     +-[DOT] '.'
                |  |     |  +-[DOT] '.'
                |  |     |  |  +-[DOT] '.'
                |  |     |  |  |  +-[DOT] '.'
                |  |     |  |  |  |  +-[DOT] '.'
                |  |     |  |  |  |  |  +-[IDENT] 'org'
                |  |     |  |  |  |  |  \-[IDENT] 'rhq'
                |  |     |  |  |  |  \-[IDENT] 'core'
                |  |     |  |  |  \-[IDENT] 'domain'
                |  |     |  |  \-[IDENT] 'alert'
                |  |     |  \-[IDENT] 'AlertConditionLog'
                |  |     \-[ALIAS] 'iacl'
                |  \-[SELECT] 'SELECT'
                |     \-[DOT] '.'
                |        +-[IDENT] 'iacl'
                |        \-[IDENT] 'id'
                \-[WHERE] 'WHERE'
                   \-[EQ] '='
                      +-[DOT] '.'
                      |  +-[DOT] '.'
                      |  |  +-[DOT] '.'
                      |  |  |  +-[DOT] '.'
                      |  |  |  |  +-[IDENT] 'iacl'
                      |  |  |  |  \-[IDENT] 'condition'
                      |  |  |  \-[IDENT] 'alertDefinition'
                      |  |  \-[IDENT] 'resource'
                      |  \-[IDENT] 'id'
                      \-[COLON] ':'
                         \-[IDENT] 'resourceId'

DEBUG 08-04 10:48:19,093 (ErrorCounter.java:throwQueryException:68)  -throwQueryException() : no errors
DEBUG 08-04 10:48:19,093 (HqlSqlBaseWalker.java:beforeStatement:111)  -delete << begin [level=1, statement=delete]
DEBUG 08-04 10:48:19,093 (FromElement.java:doInitialize:108)  -FromClause{level=1} :  org.rhq.core.domain.alert.AlertConditionLog (acl) -> alertcondi0_
DEBUG 08-04 10:48:19,109 (FromReferenceNode.java:setResolved:51)  -Resolved :  acl -> ID
DEBUG 08-04 10:48:19,109 (DotNode.java:getDataType:569)  -getDataType() : id -> org.hibernate.type.IntegerType@b872ad
DEBUG 08-04 10:48:19,109 (FromReferenceNode.java:setResolved:51)  -Resolved :  acl.id -> ID
DEBUG 08-04 10:48:19,109 (HqlSqlBaseWalker.java:beforeStatement:111)  -select << begin [level=2, statement=delete]
DEBUG 08-04 10:48:19,109 (FromElement.java:doInitialize:108)  -FromClause{level=2} :  org.rhq.core.domain.alert.AlertConditionLog (iacl) -> alertcondi1_
DEBUG 08-04 10:48:19,109 (FromReferenceNode.java:setResolved:51)  -Resolved :  iacl -> ID
DEBUG 08-04 10:48:19,109 (DotNode.java:getDataType:569)  -getDataType() : id -> org.hibernate.type.IntegerType@b872ad
DEBUG 08-04 10:48:19,109 (FromReferenceNode.java:setResolved:51)  -Resolved :  iacl.id -> alertcondi1_.ID
DEBUG 08-04 10:48:19,109 (FromReferenceNode.java:setResolved:51)  -Resolved :  iacl -> ID
DEBUG 08-04 10:48:19,109 (DotNode.java:getDataType:569)  -getDataType() : condition -> org.hibernate.type.ManyToOneType(org.rhq.core.domain.alert.AlertCondition)
DEBUG 08-04 10:48:19,125 (DotNode.java:dereferenceEntityJoin:367)  -dereferenceEntityJoin() : generating join for condition in org.rhq.core.domain.alert.AlertConditionLog {no alias} parent = [  ( . ( . ID condition ) alertDefinition ) ]
DEBUG 08-04 10:48:19,125 (FromElement.java:doInitialize:108)  -FromClause{level=2} :  org.rhq.core.domain.alert.AlertCondition (no alias) -> alertcondi2_
DEBUG 08-04 10:48:19,125 (FromClause.java:addJoinByPathMap:234)  -addJoinByPathMap() : iacl.condition -> RHQ_ALERT_CONDITION alertcondi2_
DEBUG 08-04 10:48:19,125 (FromReferenceNode.java:setResolved:51)  -Resolved :  iacl.condition -> alertcondi1_.CONDITION_ID
DEBUG 08-04 10:48:19,125 (DotNode.java:getDataType:569)  -getDataType() : alertDefinition -> org.hibernate.type.ManyToOneType(org.rhq.core.domain.alert.AlertDefinition)
DEBUG 08-04 10:48:19,125 (DotNode.java:dereferenceEntityJoin:367)  -dereferenceEntityJoin() : generating join for alertDefinition in org.rhq.core.domain.alert.AlertCondition {no alias} parent = [  ( . ( . ( alertcondi1_.CONDITION_ID ID condition ) alertDefinition ) resource ) ]
DEBUG 08-04 10:48:19,140 (FromElement.java:doInitialize:108)  -FromClause{level=2} :  org.rhq.core.domain.alert.AlertDefinition (no alias) -> alertdefin3_
DEBUG 08-04 10:48:19,140 (FromClause.java:addJoinByPathMap:234)  -addJoinByPathMap() : iacl.condition.alertDefinition -> RHQ_ALERT_DEFINITION alertdefin3_
DEBUG 08-04 10:48:19,140 (FromReferenceNode.java:setResolved:51)  -Resolved :  iacl.condition.alertDefinition -> alertcondi2_.ALERT_DEFINITION_ID
DEBUG 08-04 10:48:19,140 (DotNode.java:getDataType:569)  -getDataType() : resource -> org.hibernate.type.ManyToOneType(org.rhq.core.domain.resource.Resource)
DEBUG 08-04 10:48:19,140 (DotNode.java:dereferenceEntityIdentifier:526)  -dereferenceShortcut() : property id in org.rhq.core.domain.alert.AlertDefinition does not require a join.
DEBUG 08-04 10:48:19,140 (DotNode.java:setPropertyNameAndPath:550)  -Unresolved property path is now 'resource.id'
DEBUG 08-04 10:48:19,140 (FromReferenceNode.java:setResolved:51)  -Resolved :  iacl.condition.alertDefinition.resource -> alertdefin3_.RESOURCE_ID
DEBUG 08-04 10:48:19,140 (DotNode.java:getDataType:569)  -getDataType() : resource.id -> org.hibernate.type.IntegerType@b872ad
DEBUG 08-04 10:48:19,140 (FromReferenceNode.java:setResolved:51)  -Resolved :  iacl.condition.alertDefinition.resource.id -> alertdefin3_.RESOURCE_ID
DEBUG 08-04 10:48:19,140 (HqlSqlBaseWalker.java:beforeStatementCompletion:117)  -select : finishing up [level=2, statement=delete]
DEBUG 08-04 10:48:19,156 (HqlSqlWalker.java:processQuery:509)  -processQuery() :  ( SELECT ( {select clause} ( alertcondi1_.ID ID id ) ) ( FromClause{level=2} RHQ_ALERT_CONDITION_LOG alertcondi1_ RHQ_ALERT_CONDITION alertcondi2_ RHQ_ALERT_DEFINITION alertdefin3_ ) ( WHERE ( = ( alertdefin3_.RESOURCE_ID ( alertdefin3_.RESOURCE_ID ( alertcondi2_.ALERT_DEFINITION_ID ( alertcondi1_.CONDITION_ID ID condition ) alertDefinition ) resource ) id ) ? ) ) )
DEBUG 08-04 10:48:19,156 (JoinProcessor.java:addJoinNodes:148)  -Using FROM fragment [RHQ_ALERT_CONDITION_LOG alertcondi1_]
DEBUG 08-04 10:48:19,156 (SyntheticAndFactory.java:addWhereFragment:58)  -Using WHERE fragment [alertcondi1_.CONDITION_ID=alertcondi2_.ID]
DEBUG 08-04 10:48:19,156 (SyntheticAndFactory.java:addWhereFragment:58)  -Using WHERE fragment [alertcondi2_.ALERT_DEFINITION_ID=alertdefin3_.ID]
DEBUG 08-04 10:48:19,156 (HqlSqlBaseWalker.java:afterStatementCompletion:123)  -select >> end [level=2, statement=delete]
DEBUG 08-04 10:48:19,156 (HqlSqlBaseWalker.java:beforeStatementCompletion:117)  -delete : finishing up [level=1, statement=delete]
DEBUG 08-04 10:48:19,156 (HqlSqlBaseWalker.java:afterStatementCompletion:123)  -delete >> end [level=1, statement=delete]
DEBUG 08-04 10:48:19,171 (QueryTranslatorImpl.java:analyze:232)  ---- SQL AST ---
\-[DELETE] DeleteStatement: 'DELETE'  querySpaces (RHQ_ALERT_CONDITION,RHQ_ALERT_CONDITION_LOG,RHQ_ALERT_DEFINITION)
    +-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[acl], fromElementByTableAlias=[alertcondi0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
    |  \-[FROM_FRAGMENT] FromElement: 'RHQ_ALERT_CONDITION_LOG' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=acl,role=null,tableName=RHQ_ALERT_CONDITION_LOG,tableAlias=alertcondi0_,origin=null,colums={,className=org.rhq.core.domain.alert.AlertConditionLog}}
    \-[WHERE] SqlNode: 'WHERE'
       \-[IN] InLogicOperatorNode: 'in'
          +-[DOT] DotNode: 'ID' {propertyName=id,dereferenceType=4,propertyPath=id,path=acl.id,tableAlias=alertcondi0_,className=org.rhq.core.domain.alert.AlertConditionLog,classAlias=acl}
          |  +-[ALIAS_REF] IdentNode: 'ID' {alias=acl, className=org.rhq.core.domain.alert.AlertConditionLog, tableAlias=alertcondi0_}
          |  \-[IDENT] IdentNode: 'id' {originalText=id}
          \-[IN_LIST] SqlNode: 'inList'
             \-[SELECT] QueryNode: 'SELECT'  querySpaces (RHQ_ALERT_CONDITION,RHQ_ALERT_CONDITION_LOG,RHQ_ALERT_DEFINITION)
                +-[SELECT_CLAUSE] SelectClause: '{select clause}'
                |  \-[DOT] DotNode: 'alertcondi1_.ID' {propertyName=id,dereferenceType=4,propertyPath=id,path=iacl.id,tableAlias=alertcondi1_,className=org.rhq.core.domain.alert.AlertConditionLog,classAlias=iacl}
                |     +-[ALIAS_REF] IdentNode: 'ID' {alias=iacl, className=org.rhq.core.domain.alert.AlertConditionLog, tableAlias=alertcondi1_}
                |     \-[IDENT] IdentNode: 'id' {originalText=id}
                +-[FROM] FromClause: 'FROM' FromClause{level=2, fromElementCounter=3, fromElements=3, fromElementByClassAlias=[iacl], fromElementByTableAlias=[alertdefin3_, alertcondi2_, alertcondi1_], fromElementsByPath=[iacl.condition, iacl.condition.alertDefinition], collectionJoinFromElementsByPath=[], impliedElements=[]}
                |  +-[FROM_FRAGMENT] FromElement: 'RHQ_ALERT_CONDITION_LOG alertcondi1_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=iacl,role=null,tableName=RHQ_ALERT_CONDITION_LOG,tableAlias=alertcondi1_,origin=null,colums={,className=org.rhq.core.domain.alert.AlertConditionLog}}
                |  +-[FROM_FRAGMENT] ImpliedFromElement: 'RHQ_ALERT_CONDITION alertcondi2_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=RHQ_ALERT_CONDITION,tableAlias=alertcondi2_,origin=RHQ_ALERT_CONDITION_LOG alertcondi1_,colums={alertcondi1_.CONDITION_ID ,className=org.rhq.core.domain.alert.AlertCondition}}
                |  \-[FROM_FRAGMENT] ImpliedFromElement: 'RHQ_ALERT_DEFINITION alertdefin3_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=RHQ_ALERT_DEFINITION,tableAlias=alertdefin3_,origin=RHQ_ALERT_CONDITION alertcondi2_,colums={alertcondi2_.ALERT_DEFINITION_ID ,className=org.rhq.core.domain.alert.AlertDefinition}}
                \-[WHERE] SqlNode: 'WHERE'
                   +-[THETA_JOINS] SqlNode: '{theta joins}'
                   |  +-[SQL_TOKEN] SqlFragment: 'alertcondi1_.CONDITION_ID=alertcondi2_.ID'
                   |  \-[SQL_TOKEN] SqlFragment: 'alertcondi2_.ALERT_DEFINITION_ID=alertdefin3_.ID'
                   \-[EQ] BinaryLogicOperatorNode: '='
                      +-[DOT] DotNode: 'alertdefin3_.RESOURCE_ID' {propertyName=id,dereferenceType=4,propertyPath=resource.id,path=iacl.condition.alertDefinition.resource.id,tableAlias=alertdefin3_,className=org.rhq.core.domain.alert.AlertDefinition,classAlias=null}
                      |  +-[DOT] DotNode: 'alertdefin3_.RESOURCE_ID' {propertyName=id,dereferenceType=ROOT_LEVEL,propertyPath=resource.id,path=iacl.condition.alertDefinition.resource,tableAlias=alertdefin3_,className=org.rhq.core.domain.alert.AlertDefinition,classAlias=null}
                      |  |  +-[DOT] DotNode: 'alertcondi2_.ALERT_DEFINITION_ID' {propertyName=alertDefinition,dereferenceType=1,propertyPath=alertDefinition,path=iacl.condition.alertDefinition,tableAlias=alertdefin3_,className=org.rhq.core.domain.alert.AlertDefinition,classAlias=null}
                      |  |  |  +-[DOT] DotNode: 'alertcondi1_.CONDITION_ID' {propertyName=condition,dereferenceType=1,propertyPath=condition,path=iacl.condition,tableAlias=alertcondi2_,className=org.rhq.core.domain.alert.AlertCondition,classAlias=null}
                      |  |  |  |  +-[ALIAS_REF] IdentNode: 'ID' {alias=iacl, className=org.rhq.core.domain.alert.AlertConditionLog, tableAlias=alertcondi1_}
                      |  |  |  |  \-[IDENT] IdentNode: 'condition' {originalText=condition}
                      |  |  |  \-[IDENT] IdentNode: 'alertDefinition' {originalText=alertDefinition}
                      |  |  \-[IDENT] IdentNode: 'resource' {originalText=resource}
                      |  \-[IDENT] IdentNode: 'id' {originalText=id}
                      \-[NAMED_PARAM] ParameterNode: '?' {name=resourceId, expectedType=org.hibernate.type.IntegerType@b872ad}

DEBUG 08-04 10:48:19,171 (ErrorCounter.java:throwQueryException:68)  -throwQueryException() : no errors
DEBUG 08-04 10:48:19,171 (ErrorCounter.java:throwQueryException:68)  -throwQueryException() : no errors
DEBUG 08-04 10:48:21,437 (IdleRemover.java:run:162)  -run: IdleRemover notifying pools, interval: 50000
DEBUG 08-04 10:48:31,500 (AbstractBatcher.java:logOpenPreparedStatement:366)  -about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG 08-04 10:48:31,531 (ConnectionManager.java:openConnection:421)  -opening JDBC connection
DEBUG 08-04 10:48:31,656 (AbstractBatcher.java:log:401)  -
    delete
    from
        RHQ_ALERT_CONDITION_LOG
    where
        ID in (
            select
                alertcondi1_.ID
            from
                RHQ_ALERT_CONDITION_LOG alertcondi1_,
                RHQ_ALERT_CONDITION alertcondi2_,
                RHQ_ALERT_DEFINITION alertdefin3_
            where
                alertcondi1_.CONDITION_ID=alertcondi2_.ID
                and alertcondi2_.ALERT_DEFINITION_ID=alertdefin3_.ID
                and alertdefin3_.RESOURCE_ID=?
        )
DEBUG 08-04 10:48:31,734 (AbstractBatcher.java:logClosePreparedStatement:374)  -about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG 08-04 10:48:31,734 (ConnectionManager.java:aggressiveRelease:404)  -aggressively releasing JDBC connection
DEBUG 08-04 10:48:31,750 (ConnectionManager.java:closeConnection:441)  -releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG 08-04 10:48:31,781 (JDBCExceptionReporter.java:logExceptions:69)  -could not execute update query [delete from RHQ_ALERT_CONDITION_LOG where ID in (select alertcondi1_.ID from RHQ_ALERT_CONDITION_LOG alertcondi1_, RHQ_ALERT_CONDITION alertcondi2_, RHQ_ALERT_DEFINITION alertdefin3_ where alertcondi1_.CONDITION_ID=alertcondi2_.ID and alertcondi2_.ALERT_DEFINITION_ID=alertdefin3_.ID and alertdefin3_.RESOURCE_ID=?)]
java.sql.SQLException: You can't specify target table 'RHQ_ALERT_CONDITION_LOG' for update in FROM clause
   at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
   at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519)
   at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1504)
   at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:251)
   at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
   at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396)
   at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
   at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141)
   at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
   at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:48)
   at org.rhq.enterprise.server.alert.AlertManagerBean.deleteAlerts(AlertManagerBean.java:166)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:121)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:110)
   at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
   at org.rhq.enterprise.server.authz.RequiredPermissionsInterceptor.checkRequiredPermissions(RequiredPermissionsInterceptor.java:153)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
   at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
   at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:275)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
   at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
   at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
   at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
   at $Proxy106.deleteAlerts(Unknown Source)
   at org.rhq.enterprise.server.alert.test.AlertManagerBeanTest.testAlertDelete(AlertManagerBeanTest.java:68)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
   at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
   at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:607)
   at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:874)
   at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
   at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
   at org.testng.TestRunner.runWorkers(TestRunner.java:689)
   at org.testng.TestRunner.privateRun(TestRunner.java:566)
   at org.testng.TestRunner.run(TestRunner.java:466)
   at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
   at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
   at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
   at org.testng.SuiteRunner.run(SuiteRunner.java:191)
   at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
   at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
   at org.testng.TestNG.run(TestNG.java:701)
   at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
   at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:136)
   at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
   at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
WARN  08-04 10:48:31,843 (JDBCExceptionReporter.java:logExceptions:77)  -SQL Error: 1093, SQLState: HY000
ERROR 08-04 10:48:31,859 (JDBCExceptionReporter.java:logExceptions:78)  -You can't specify target table 'RHQ_ALERT_CONDITION_LOG' for update in FROM clause
DEBUG 08-04 10:48:31,875 (AbstractEntityManagerImpl.java:markAsRollback:417)  -mark transaction for rollback


Thanks,
illya


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 11, 2008 8:31 am 
Newbie

Joined: Wed Apr 09, 2008 4:19 am
Posts: 3
As I checked Hibernate sources It could be somewhere in classes
  • package org.hibernate.hql.ast
    • class QueryTranslatorImpl
    • class SqlGenerator
    • class HqlSqlWalker
  • package org.hibernate.hql.ast.exec
    • class AbstractStatementExecutor
    • class MultiTableDeleteExecutor
    • class MultiTableUpdateExecutor


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.