-->
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.  [ 1 post ] 
Author Message
 Post subject: Incorrect SQL generated for complex HQL query
PostPosted: Thu Nov 10, 2005 2:31 pm 
From a complex query, Hibernate generates incorrect SQL by referring to a column that only exists in a different table. The same query worked properly in Hibernate 2.1.6 and 2.1.8.

The offending query is below. The only selected column GROUP_POLICY_VERSION_ID only exists in table SC_POLICY_GROUP_MEMBER which is mapped in a many-to-many relationship between different types stored in SC_POLICY_VERSION. I checked the generated SQL from Hibernate 2.1.8, and it selected the correct column POLICY_VERSION_ID.

Hibernate version: 3.0.5

Mapping documents:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class table="SC_POLICY_VERSION" discriminator-value="-1" name="com.scentric.destiny.db.model.policy.SCPolicyVersionPO">
<cache usage="read-write"/>
<id column="POLICY_VERSION_ID" unsaved-value="null" name="id">
<generator class="increment"/>
</id>
<discriminator type="integer" column="POLICY_VERSION_TYPE"/>
<many-to-one foreign-key="FK_POLICY_VERSION_POLICY" cascade="save-update" name="policy" class="com.scentric.destiny.db.model.policy.SCPolicyPO">
<column name="POLICY_ID"/>
</many-to-one>
<property name="versionDate" column="VERSION_DATE"/>
<property name="versionNumber" column="VERSION_NUMBER"/>
<property name="versionPosition" column="VERSION_POSITION"/>
<many-to-one foreign-key="FK_POLICY_VERSION_USER" cascade="none" name="user" class="com.scentric.destiny.db.model.user.SCUserPO">
<column name="USER_ID"/>
</many-to-one>
<property name="name" column="POLICY_NAME"/>
<property name="description" length="30000" column="POLICY_DESCRIPTION"/>
<property name="priority" column="POLICY_PRIORITY"/>
<property name="orderSignificance" column="ORDER_SIGNIFICANCE"/>
<property name="startTime" column="START_TIME"/>
<property name="endTime" column="END_TIME"/>
<property name="elementHint" column="ELEMENT_HINT"/>
<subclass name="com.scentric.destiny.db.model.policy.SCPolicyGroupVersionPO" discriminator-value="1">
<list lazy="true" cascade="all-delete-orphan" name="conditionGroups">
<key column="POLICY_VERSION_ID"/>
<index column="CONDITION_INDEX"/>
<one-to-many class="com.scentric.destiny.db.model.condition.SCConditionGroupPO"/>
</list>
<bag table="sc_policy_time_period_condition" lazy="true" inverse="true" cascade="all-delete-orphan" name="policySchedules">
<key column="POLICY_VERSION_ID"/>
<one-to-many class="com.scentric.destiny.db.model.policy.SCPolicySchedulePO"/>
</bag>
<list table="SC_POLICY_GROUP_MEMBER" lazy="true" cascade="save-update" name="policyRuleVersions">
<key column="GROUP_POLICY_VERSION_ID"/>
<index column="RULE_INDEX"/>
<many-to-many column="RULE_POLICY_VERSION_ID" class="com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO"/>
</list>
<list lazy="true" cascade="all-delete-orphan" name="policyExecutions">
<key column="POLICY_VERSION_ID"/>
<index column="POLICY_EXECUTION_INDEX"/>
<one-to-many class="com.scentric.destiny.db.model.policy.SCPolicyExecutionPO"/>
</list>
</subclass>
<subclass name="com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO" discriminator-value="2">
<property name="conditionType" column="CONDITION_TYPE"/>
<set table="SC_POLICY_GROUP_MEMBER" lazy="true" inverse="true" cascade="none" name="policyGroupVersions">
<key column="RULE_POLICY_VERSION_ID"/>
<many-to-many column="GROUP_POLICY_VERSION_ID" class="com.scentric.destiny.db.model.policy.SCPolicyGroupVersionPO"/>
</set>
<list lazy="true" cascade="all-delete-orphan" name="policyActions">
<key column="POLICY_VERSION_ID"/>
<index column="ACTION_INDEX"/>
<one-to-many class="com.scentric.destiny.db.model.policy.SCActionPO"/>
</list>
</subclass>
</class>
</hibernate-mapping>

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class table="SC_POLICY_ACTION" discriminator-value="0" name="com.scentric.destiny.db.model.policy.SCActionPO">
<id column="POLICY_ACTION_ID" unsaved-value="null" name="id">
<generator class="increment"/>
</id>
<discriminator type="integer" column="ACTION_TYPE"/>
<many-to-one foreign-key="FK_POLICY_ACTION_RULE" cascade="none" name="policyRuleVersion" class="com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO">
<column name="POLICY_VERSION_ID"/>
</many-to-one>
<bag table="SC_POLICY_ACTION_ELEMENT" lazy="true" inverse="true" cascade="all-delete-orphan" name="policyActionElements">
<key column="POLICY_ACTION_ID"/>
<one-to-many class="com.scentric.destiny.db.model.policy.SCPolicyActionElementPO"/>
</bag>
<list lazy="true" cascade="all-delete-orphan" name="conditionGroups">
<key column="POLICY_ACTION_ID"/>
<index column="CONDITION_INDEX"/>
<one-to-many class="com.scentric.destiny.db.model.condition.SCConditionGroupPO"/>
</list>
<subclass name="com.scentric.destiny.db.model.policy.SCAlertActionPO" discriminator-value="16">
<property name="importance" column="ALERT_IMPORTANCE"/>
<set lazy="true" inverse="true" cascade="all-delete-orphan" name="alertContacts">
<key column="POLICY_ACTION_ID"/>
<one-to-many class="com.scentric.destiny.db.model.policy.SCAlertActionContactPO"/>
</set>
<property name="pagerNumber" length="30" column="PAGER_NUMBER"/>
</subclass>
<subclass name="com.scentric.destiny.db.model.policy.SCDeleteAttachmentsActionPO" discriminator-value="14"/>
<subclass name="com.scentric.destiny.db.model.policy.SCDeleteEmailActionPO" discriminator-value="11"/>
<subclass name="com.scentric.destiny.db.model.policy.SCDeletePubFolderContentActionPO" discriminator-value="15"/>
<subclass name="com.scentric.destiny.db.model.policy.SCDestinationActionPO" discriminator-value="1">
<many-to-one column="ELEMENT_SET_CATEGORY_ID" name="destinationCategory"/>
<subclass name="com.scentric.destiny.db.model.policy.SCArchiveActionPO" discriminator-value="2"/>
<subclass name="com.scentric.destiny.db.model.policy.SCCompressActionPO" discriminator-value="3">
<property name="compressChar" column="IS_COMPRESS"/>
<property name="inplaceCompressionChar" column="IS_INPLACE_COMPRESSION"/>
</subclass>
<subclass name="com.scentric.destiny.db.model.policy.SCCopyActionPO" discriminator-value="4"/>
<subclass name="com.scentric.destiny.db.model.policy.SCCopyEmailActionPO" discriminator-value="12"/>
<subclass name="com.scentric.destiny.db.model.policy.SCDeleteActionPO" discriminator-value="5"/>
<subclass name="com.scentric.destiny.db.model.policy.SCMoveActionPO" discriminator-value="6">
<property name="transparency" column="MOVE_TRANSPARENCY"/>
</subclass>
<subclass name="com.scentric.destiny.db.model.policy.SCMoveAttachmentsActionPO" discriminator-value="13"/>
<subclass name="com.scentric.destiny.db.model.policy.SCMoveEmailActionPO" discriminator-value="10"/>
<subclass name="com.scentric.destiny.db.model.policy.SCSynchronizeActionPO" discriminator-value="7"/>
</subclass>
<subclass name="com.scentric.destiny.db.model.policy.SCRunScriptActionPO" discriminator-value="8">
<property name="lines" column="SCRIPT_LINES"/>
<property name="username" column="SCRIPT_USERNAME"/>
<property name="password" column="SCRIPT_PASSWORD"/>
</subclass>
</class>
</hibernate-mapping>

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class table="SC_POLICY_ACTION_ELEMENT" name="com.scentric.destiny.db.model.policy.SCPolicyActionElementPO">
<cache usage="read-write"/>
<id column="POLICY_ACTION_ELEMENT_ID" unsaved-value="null" name="id">
<generator class="increment"/>
</id>
<property name="isDestinationStr" column="IS_DESTINATION"/>
<many-to-one column="ELEMENT_ID" cascade="save-update" name="managedElement"/>
<many-to-one column="POLICY_ACTION_ID" cascade="none" name="policyAction"/>
</class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():

N/A

Full stack trace of any exception that occurs:

see the log excerpt below

Name and version of the database you are using:

MySQL 4.1.7

The generated SQL (show_sql=true):

select ae.policyAction.policyRuleVersion.policyGroupVersions.elements from SCPolicyActionElementPO ae where ae.managedElement = :element and ae.policyAction.policyRuleVersion.versionPosition = 'L' and ae.isDestinationStr = 'N'

select scpolicygr4_.GROUP_POLICY_VERSION_ID as col_0_0_
from SC_POLICY_ACTION_ELEMENT scpolicyac0_,
SC_POLICY_ACTION scactionpo1_,
SC_POLICY_VERSION scpolicyru2_,
SC_POLICY_GROUP_MEMBER policygrou3_,
SC_POLICY_VERSION scpolicygr4_
where scpolicyru2_.POLICY_VERSION_ID=policygrou3_.RULE_POLICY_VERSION_ID
and policygrou3_.GROUP_POLICY_VERSION_ID=scpolicygr4_.POLICY_VERSION_ID
and scactionpo1_.POLICY_VERSION_ID=scpolicyru2_.POLICY_VERSION_ID
and scpolicyac0_.POLICY_ACTION_ID=scactionpo1_.POLICY_ACTION_ID
and scpolicyac0_.ELEMENT_ID=?
and scpolicyru2_.VERSION_POSITION='L'
and scpolicyac0_.IS_DESTINATION='N'

Debug level Hibernate log excerpt:

2005-11-10 12:23:16,426 DEBUG [org.hibernate.impl.SessionImpl] (RMI TCP Connection(6)-10.0.1.194:) find: select ae.policyAction.policyRuleVersion.policyGroupVersions.elements from SCPolicyActionElementPO ae where ae.managedElement = :element and ae.policyAction.policyRuleVersion.versionPosition = 'L' and ae.isDestinationStr = 'N'
2005-11-10 12:23:16,426 DEBUG [org.hibernate.engine.QueryParameters] (RMI TCP Connection(6)-10.0.1.194:) named parameters: {element=com.scentric.destiny.db.model.element.SCElementSetPO#6}
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] (RMI TCP Connection(6)-10.0.1.194:) parse() - HQL: select ae.policyAction.policyRuleVersion.policyGroupVersions.elements from com.scentric.destiny.db.model.policy.SCPolicyActionElementPO ae where ae.managedElement = :element and ae.policyAction.policyRuleVersion.versionPosition = 'L' and ae.isDestinationStr = 'N'
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.AST] (RMI TCP Connection(6)-10.0.1.194:) --- HQL AST ---
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| +-[FROM] 'from'
| | \-[RANGE] 'RANGE'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[DOT] '.'
| | | | | +-[DOT] '.'
| | | | | | +-[DOT] '.'
| | | | | | | +-[DOT] '.'
| | | | | | | | +-[IDENT] 'com'
| | | | | | | | \-[IDENT] 'scentric'
| | | | | | | \-[IDENT] 'destiny'
| | | | | | \-[IDENT] 'db'
| | | | | \-[IDENT] 'model'
| | | | \-[IDENT] 'policy'
| | | \-[IDENT] 'SCPolicyActionElementPO'
| | \-[ALIAS] 'ae'
| \-[SELECT] 'select'
| \-[DOT] '.'
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[IDENT] 'ae'
| | | | \-[IDENT] 'policyAction'
| | | \-[IDENT] 'policyRuleVersion'
| | \-[IDENT] 'policyGroupVersions'
| \-[ELEMENTS] 'elements'
\-[WHERE] 'where'
\-[AND] 'and'
+-[AND] 'and'
| +-[EQ] '='
| | +-[DOT] '.'
| | | +-[IDENT] 'ae'
| | | \-[IDENT] 'managedElement'
| | \-[COLON] ':'
| | \-[IDENT] 'element'
| \-[EQ] '='
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[IDENT] 'ae'
| | | | \-[IDENT] 'policyAction'
| | | \-[IDENT] 'policyRuleVersion'
| | \-[IDENT] 'versionPosition'
| \-[QUOTED_STRING] ''L''
\-[EQ] '='
+-[DOT] '.'
| +-[IDENT] 'ae'
| \-[IDENT] 'isDestinationStr'
\-[QUOTED_STRING] ''N''

2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.ErrorCounter] (RMI TCP Connection(6)-10.0.1.194:) throwQueryException() : no errors
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.antlr.HqlSqlBaseWalker] (RMI TCP Connection(6)-10.0.1.194:) query() << begin, level = 1
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromElement] (RMI TCP Connection(6)-10.0.1.194:) FromClause{level=1} : com.scentric.destiny.db.model.policy.SCPolicyActionElementPO (ae) -> scpolicyac0_
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae -> scpolicyac0_.POLICY_ACTION_ELEMENT_ID
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : policyAction -> org.hibernate.type.ManyToOneType(com.scentric.destiny.db.model.policy.SCActionPO)
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) dereferenceEntityJoin() : generating join for policyAction in com.scentric.destiny.db.model.policy.SCPolicyActionElementPO {no alias} parent = [ ( . ( . scpolicyac0_.POLICY_ACTION_ELEMENT_ID policyAction ) policyRuleVersion ) ]
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromElement] (RMI TCP Connection(6)-10.0.1.194:) FromClause{level=1} : com.scentric.destiny.db.model.policy.SCActionPO (no alias) -> scactionpo1_
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromClause] (RMI TCP Connection(6)-10.0.1.194:) addJoinByPathMap() : ae.policyAction -> SC_POLICY_ACTION scactionpo1_
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.policyAction -> scpolicyac0_.POLICY_ACTION_ID
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : policyRuleVersion -> org.hibernate.type.ManyToOneType(com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO)
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) dereferenceEntityJoin() : generating join for policyRuleVersion in com.scentric.destiny.db.model.policy.SCActionPO {no alias} parent = [ ( . ( . ( scpolicyac0_.POLICY_ACTION_ID scpolicyac0_.POLICY_ACTION_ELEMENT_ID policyAction ) policyRuleVersion ) policyGroupVersions ) ]
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromElement] (RMI TCP Connection(6)-10.0.1.194:) FromClause{level=1} : com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO (no alias) -> scpolicyru2_
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromClause] (RMI TCP Connection(6)-10.0.1.194:) addJoinByPathMap() : ae.policyAction.policyRuleVersion -> SC_POLICY_VERSION scpolicyru2_
2005-11-10 12:23:16,426 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.policyAction.policyRuleVersion -> scactionpo1_.POLICY_VERSION_ID
2005-11-10 12:23:16,466 DEBUG [org.hibernate.hql.ast.HqlSqlWalker] (RMI TCP Connection(6)-10.0.1.194:) lookupProperty() ae.policyAction.policyRuleVersion.policyGroupVersions.elements => elements(ae.policyAction.policyRuleVersion.policyGroupVersions)
2005-11-10 12:23:16,466 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : policyGroupVersions -> org.hibernate.type.SetType(com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO.policyGroupVersions)
2005-11-10 12:23:16,466 DEBUG [org.hibernate.hql.ast.FromElementFactory] (RMI TCP Connection(6)-10.0.1.194:) createManyToMany() : path = ae.policyAction.policyRuleVersion.policyGroupVersions role = com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO.policyGroupVersions associatedEntityName = com.scentric.destiny.db.model.policy.SCPolicyGroupVersionPO
2005-11-10 12:23:16,466 DEBUG [org.hibernate.hql.ast.FromElement] (RMI TCP Connection(6)-10.0.1.194:) FromClause{level=1} : com.scentric.destiny.db.model.policy.SCPolicyGroupVersionPO (no alias) -> scpolicygr4_
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromClause] (RMI TCP Connection(6)-10.0.1.194:) addJoinByPathMap() : ae.policyAction.policyRuleVersion.policyGroupVersions -> SC_POLICY_VERSION scpolicygr4_
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) dereferenceCollection() : Created new FROM element for ae.policyAction.policyRuleVersion.policyGroupVersions : SC_POLICY_GROUP_MEMBER scpolicygr4_
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.policyAction.policyRuleVersion.policyGroupVersions -> .
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.MethodNode] (RMI TCP Connection(6)-10.0.1.194:) Creating elements for ae.policyAction.policyRuleVersion.policyGroupVersions[].elements
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae -> scpolicyac0_.POLICY_ACTION_ELEMENT_ID
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : managedElement -> org.hibernate.type.ManyToOneType(com.scentric.destiny.db.model.element.SCElementPO)
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) dereferenceShortcut() : property managedElement in com.scentric.destiny.db.model.policy.SCPolicyActionElementPO does not require a join.
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.managedElement -> scpolicyac0_.ELEMENT_ID
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae -> scpolicyac0_.POLICY_ACTION_ELEMENT_ID
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : policyAction -> org.hibernate.type.ManyToOneType(com.scentric.destiny.db.model.policy.SCActionPO)
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) dereferenceEntityJoin() : generating join for policyAction in com.scentric.destiny.db.model.policy.SCPolicyActionElementPO {no alias} parent = [ ( . ( . scpolicyac0_.POLICY_ACTION_ELEMENT_ID policyAction ) policyRuleVersion ) ]
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.policyAction -> scpolicyac0_.POLICY_ACTION_ID
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : policyRuleVersion -> org.hibernate.type.ManyToOneType(com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO)
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) dereferenceEntityJoin() : generating join for policyRuleVersion in com.scentric.destiny.db.model.policy.SCActionPO {no alias} parent = [ ( . ( . ( scpolicyac0_.POLICY_ACTION_ID scpolicyac0_.POLICY_ACTION_ELEMENT_ID policyAction ) policyRuleVersion ) versionPosition ) ]
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.policyAction.policyRuleVersion -> scactionpo1_.POLICY_VERSION_ID
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : versionPosition -> org.hibernate.type.CharacterType@ae11f6
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.policyAction.policyRuleVersion.versionPosition -> scpolicyru2_.VERSION_POSITION
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae -> scpolicyac0_.POLICY_ACTION_ELEMENT_ID
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.DotNode] (RMI TCP Connection(6)-10.0.1.194:) getDataType() : isDestinationStr -> org.hibernate.type.CharacterType@ae11f6
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.FromReferenceNode] (RMI TCP Connection(6)-10.0.1.194:) Resolved : ae.isDestinationStr -> scpolicyac0_.IS_DESTINATION
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.antlr.HqlSqlBaseWalker] (RMI TCP Connection(6)-10.0.1.194:) query() : finishing up , level = 1
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.HqlSqlWalker] (RMI TCP Connection(6)-10.0.1.194:) processQuery() : ( SELECT ( {select clause} ( scpolicygr4_.GROUP_POLICY_VERSION_ID ( . ( scactionpo1_.POLICY_VERSION_ID ( scpolicyac0_.POLICY_ACTION_ID scpolicyac0_.POLICY_ACTION_ELEMENT_ID policyAction ) policyRuleVersion ) policyGroupVersions ) ) ) ( FromClause{level=1} ( SC_POLICY_ACTION_ELEMENT scpolicyac0_ ( SC_POLICY_ACTION scactionpo1_ ( SC_POLICY_VERSION scpolicyru2_ SC_POLICY_GROUP_MEMBER scpolicygr4_ ) ) ) ) ( where ( and ( and ( = ( scpolicyac0_.ELEMENT_ID scpolicyac0_.POLICY_ACTION_ELEMENT_ID managedElement ) ? ) ( = ( scpolicyru2_.VERSION_POSITION ( scactionpo1_.POLICY_VERSION_ID ( scpolicyac0_.POLICY_ACTION_ID scpolicyac0_.POLICY_ACTION_ELEMENT_ID policyAction ) policyRuleVersion ) versionPosition ) 'L' ) ) ( = ( scpolicyac0_.IS_DESTINATION scpolicyac0_.POLICY_ACTION_ELEMENT_ID isDestinationStr ) 'N' ) ) ) )
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.JoinProcessor] (RMI TCP Connection(6)-10.0.1.194:) Using FROM fragment [SC_POLICY_GROUP_MEMBER policygrou3_, SC_POLICY_VERSION scpolicygr4_]
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.SyntheticAndFactory] (RMI TCP Connection(6)-10.0.1.194:) Using WHERE fragment [scpolicyru2_.POLICY_VERSION_ID=policygrou3_.RULE_POLICY_VERSION_ID and policygrou3_.GROUP_POLICY_VERSION_ID=scpolicygr4_.POLICY_VERSION_ID]
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.SyntheticAndFactory] (RMI TCP Connection(6)-10.0.1.194:) Using WHERE fragment [scactionpo1_.POLICY_VERSION_ID=scpolicyru2_.POLICY_VERSION_ID]
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.SyntheticAndFactory] (RMI TCP Connection(6)-10.0.1.194:) Using WHERE fragment [scpolicyac0_.POLICY_ACTION_ID=scactionpo1_.POLICY_ACTION_ID]
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.ast.JoinProcessor] (RMI TCP Connection(6)-10.0.1.194:) Using FROM fragment [SC_POLICY_ACTION_ELEMENT scpolicyac0_]
2005-11-10 12:23:16,476 DEBUG [org.hibernate.hql.antlr.HqlSqlBaseWalker] (RMI TCP Connection(6)-10.0.1.194:) query() >> end, level = 1
2005-11-10 12:23:16,486 DEBUG [org.hibernate.hql.ast.AST] (RMI TCP Connection(6)-10.0.1.194:) --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (SC_POLICY_ACTION,SC_POLICY_GROUP_MEMBER,SC_POLICY_ACTION_ELEMENT,SC_POLICY_VERSION)
+-[SELECT_CLAUSE] SelectClause: '{select clause}'
| +-[SQL_TOKEN] CollectionFunction: 'scpolicygr4_.GROUP_POLICY_VERSION_ID' {method=elements,selectColumns=[scpolicygr4_.GROUP_POLICY_VERSION_ID],fromElement=scpolicygr4_}
| | \-[DOT] DotNode: '.' {propertyName=policyGroupVersions,dereferenceType=3,propertyPath=policyGroupVersions,path=ae.policyAction.policyRuleVersion.policyGroupVersions,tableAlias=scpolicygr4_,className=com.scentric.destiny.db.model.policy.SCPolicyGroupVersionPO,classAlias=null}
| | +-[DOT] DotNode: 'scactionpo1_.POLICY_VERSION_ID' {propertyName=policyRuleVersion,dereferenceType=1,propertyPath=policyRuleVersion,path=ae.policyAction.policyRuleVersion,tableAlias=scpolicyru2_,className=com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO,classAlias=null}
| | | +-[DOT] DotNode: 'scpolicyac0_.POLICY_ACTION_ID' {propertyName=policyAction,dereferenceType=1,propertyPath=policyAction,path=ae.policyAction,tableAlias=scactionpo1_,className=com.scentric.destiny.db.model.policy.SCActionPO,classAlias=null}
| | | | +-[ALIAS_REF] IdentNode: 'scpolicyac0_.POLICY_ACTION_ELEMENT_ID' {alias=ae, className=com.scentric.destiny.db.model.policy.SCPolicyActionElementPO, tableAlias=scpolicyac0_}
| | | | \-[IDENT] IdentNode: 'policyAction' {originalText=policyAction}
| | | \-[IDENT] IdentNode: 'policyRuleVersion' {originalText=policyRuleVersion}
| | \-[IDENT] IdentNode: 'policyGroupVersions' {originalText=policyGroupVersions}
| \-[SELECT_COLUMNS] SqlNode: ' as col_0_0_'
+-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=4, fromElements=4, fromElementByClassAlias=[null, ae], fromElementByTableAlias=[scpolicyac0_, scpolicyru2_, scactionpo1_, scpolicygr4_], fromElementsByPath=[ae.policyAction.policyRuleVersion.policyGroupVersions, ae.policyAction, ae.policyAction.policyRuleVersion], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'SC_POLICY_ACTION_ELEMENT scpolicyac0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=ae,role=null,tableName=SC_POLICY_ACTION_ELEMENT,tableAlias=scpolicyac0_,colums={,className=com.scentric.destiny.db.model.policy.SCPolicyActionElementPO}}
| \-[FROM_FRAGMENT] ImpliedFromElement: 'SC_POLICY_ACTION scactionpo1_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=SC_POLICY_ACTION,tableAlias=scactionpo1_,colums={scpolicyac0_.POLICY_ACTION_ID ,className=com.scentric.destiny.db.model.policy.SCActionPO}}
| \-[FROM_FRAGMENT] ImpliedFromElement: 'SC_POLICY_VERSION scpolicyru2_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName=SC_POLICY_VERSION,tableAlias=scpolicyru2_,colums={scactionpo1_.POLICY_VERSION_ID ,className=com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO}}
| \-[FROM_FRAGMENT] ImpliedFromElement: 'SC_POLICY_GROUP_MEMBER policygrou3_, SC_POLICY_VERSION scpolicygr4_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO.policyGroupVersions,tableName=SC_POLICY_VERSION,tableAlias=scpolicygr4_,colums={scpolicyru2_.POLICY_VERSION_ID ,className=com.scentric.destiny.db.model.policy.SCPolicyGroupVersionPO}}
\-[WHERE] SqlNode: 'where'
+-[THETA_JOINS] SqlNode: '{theta joins}'
| +-[SQL_TOKEN] SqlFragment: 'scpolicyru2_.POLICY_VERSION_ID=policygrou3_.RULE_POLICY_VERSION_ID and policygrou3_.GROUP_POLICY_VERSION_ID=scpolicygr4_.POLICY_VERSION_ID'
| +-[SQL_TOKEN] SqlFragment: 'scactionpo1_.POLICY_VERSION_ID=scpolicyru2_.POLICY_VERSION_ID'
| \-[SQL_TOKEN] SqlFragment: 'scpolicyac0_.POLICY_ACTION_ID=scactionpo1_.POLICY_ACTION_ID'
\-[AND] SqlNode: 'and'
+-[AND] SqlNode: 'and'
| +-[EQ] SqlNode: '='
| | +-[DOT] DotNode: 'scpolicyac0_.ELEMENT_ID' {propertyName=managedElement,dereferenceType=ROOT_LEVEL,propertyPath=managedElement,path=ae.managedElement,tableAlias=scpolicyac0_,className=com.scentric.destiny.db.model.policy.SCPolicyActionElementPO,classAlias=ae}
| | | +-[ALIAS_REF] IdentNode: 'scpolicyac0_.POLICY_ACTION_ELEMENT_ID' {alias=ae, className=com.scentric.destiny.db.model.policy.SCPolicyActionElementPO, tableAlias=scpolicyac0_}
| | | \-[IDENT] IdentNode: 'managedElement' {originalText=managedElement}
| | \-[NAMED_PARAM] SqlNode: '?'
| \-[EQ] SqlNode: '='
| +-[DOT] DotNode: 'scpolicyru2_.VERSION_POSITION' {propertyName=versionPosition,dereferenceType=4,propertyPath=versionPosition,path=ae.policyAction.policyRuleVersion.versionPosition,tableAlias=scpolicyru2_,className=com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO,classAlias=null}
| | +-[DOT] DotNode: 'scactionpo1_.POLICY_VERSION_ID' {propertyName=policyRuleVersion,dereferenceType=1,propertyPath=policyRuleVersion,path=ae.policyAction.policyRuleVersion,tableAlias=scpolicyru2_,className=com.scentric.destiny.db.model.policy.SCPolicyRuleVersionPO,classAlias=null}
| | | +-[DOT] DotNode: 'scpolicyac0_.POLICY_ACTION_ID' {propertyName=policyAction,dereferenceType=1,propertyPath=policyAction,path=ae.policyAction,tableAlias=scactionpo1_,className=com.scentric.destiny.db.model.policy.SCActionPO,classAlias=null}
| | | | +-[ALIAS_REF] IdentNode: 'scpolicyac0_.POLICY_ACTION_ELEMENT_ID' {alias=ae, className=com.scentric.destiny.db.model.policy.SCPolicyActionElementPO, tableAlias=scpolicyac0_}
| | | | \-[IDENT] IdentNode: 'policyAction' {originalText=policyAction}
| | | \-[IDENT] IdentNode: 'policyRuleVersion' {originalText=policyRuleVersion}
| | \-[IDENT] IdentNode: 'versionPosition' {originalText=versionPosition}
| \-[QUOTED_STRING] LiteralNode: ''L''
\-[EQ] SqlNode: '='
+-[DOT] DotNode: 'scpolicyac0_.IS_DESTINATION' {propertyName=isDestinationStr,dereferenceType=4,propertyPath=isDestinationStr,path=ae.isDestinationStr,tableAlias=scpolicyac0_,className=com.scentric.destiny.db.model.policy.SCPolicyActionElementPO,classAlias=ae}
| +-[ALIAS_REF] IdentNode: 'scpolicyac0_.POLICY_ACTION_ELEMENT_ID' {alias=ae, className=com.scentric.destiny.db.model.policy.SCPolicyActionElementPO, tableAlias=scpolicyac0_}
| \-[IDENT] IdentNode: 'isDestinationStr' {originalText=isDestinationStr}
\-[QUOTED_STRING] LiteralNode: ''N''

2005-11-10 12:23:16,486 DEBUG [org.hibernate.hql.ast.ErrorCounter] (RMI TCP Connection(6)-10.0.1.194:) throwQueryException() : no errors
2005-11-10 12:23:16,486 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] (RMI TCP Connection(6)-10.0.1.194:) HQL: select ae.policyAction.policyRuleVersion.policyGroupVersions.elements from com.scentric.destiny.db.model.policy.SCPolicyActionElementPO ae where ae.managedElement = :element and ae.policyAction.policyRuleVersion.versionPosition = 'L' and ae.isDestinationStr = 'N'
2005-11-10 12:23:16,486 DEBUG [org.hibernate.hql.ast.QueryTranslatorImpl] (RMI TCP Connection(6)-10.0.1.194:) SQL: select scpolicygr4_.GROUP_POLICY_VERSION_ID as col_0_0_ from SC_POLICY_ACTION_ELEMENT scpolicyac0_, SC_POLICY_ACTION scactionpo1_, SC_POLICY_VERSION scpolicyru2_, SC_POLICY_GROUP_MEMBER policygrou3_, SC_POLICY_VERSION scpolicygr4_ where scpolicyru2_.POLICY_VERSION_ID=policygrou3_.RULE_POLICY_VERSION_ID and policygrou3_.GROUP_POLICY_VERSION_ID=scpolicygr4_.POLICY_VERSION_ID and scactionpo1_.POLICY_VERSION_ID=scpolicyru2_.POLICY_VERSION_ID and scpolicyac0_.POLICY_ACTION_ID=scactionpo1_.POLICY_ACTION_ID and scpolicyac0_.ELEMENT_ID=? and scpolicyru2_.VERSION_POSITION='L' and scpolicyac0_.IS_DESTINATION='N'
2005-11-10 12:23:16,486 DEBUG [org.hibernate.hql.ast.ErrorCounter] (RMI TCP Connection(6)-10.0.1.194:) throwQueryException() : no errors

2005-11-10 12:23:22,525 DEBUG [org.hibernate.jdbc.AbstractBatcher] (RMI TCP Connection(6)-10.0.1.194:) about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2005-11-10 12:23:22,525 DEBUG [org.hibernate.jdbc.AbstractBatcher] (RMI TCP Connection(6)-10.0.1.194:) closing statement
2005-11-10 12:23:22,535 DEBUG [org.hibernate.util.JDBCExceptionReporter] (RMI TCP Connection(6)-10.0.1.194:) could not execute query [select scpolicygr4_.GROUP_POLICY_VERSION_ID as col_0_0_ from SC_POLICY_ACTION_ELEMENT scpolicyac0_, SC_POLICY_ACTION scactionpo1_, SC_POLICY_VERSION scpolicyru2_, SC_POLICY_GROUP_MEMBER policygrou3_, SC_POLICY_VERSION scpolicygr4_ where scpolicyru2_.POLICY_VERSION_ID=policygrou3_.RULE_POLICY_VERSION_ID and policygrou3_.GROUP_POLICY_VERSION_ID=scpolicygr4_.POLICY_VERSION_ID and scactionpo1_.POLICY_VERSION_ID=scpolicyru2_.POLICY_VERSION_ID and scpolicyac0_.POLICY_ACTION_ID=scactionpo1_.POLICY_ACTION_ID and scpolicyac0_.ELEMENT_ID=? and scpolicyru2_.VERSION_POSITION='L' and scpolicyac0_.IS_DESTINATION='N']
java.sql.SQLException: Unknown column 'scpolicygr4_.GROUP_POLICY_VERSION_ID' in 'field list'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2376)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2297)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1860)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1705)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:314)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.scentric.destiny.db.hibernate.dao.SCPolicyDAOHb.getPolicyByElementId(SCPolicyDAOHb.java:334)
at com.scentric.destiny.db.hibernate.dao.SCPolicyDAOHb.getPolicyProxiesForSource(SCPolicyDAOHb.java:837)
at com.scentric.destiny.bizservice.policy.core.SCPolicyRetrieverImpl.getPolicyProxiesForSource(SCPolicyRetrieverImpl.java:283)
at com.scentric.destiny.bizservice.policy.ejb.session.SCPolicyManagementServiceBean.getPolicyProxiesForSource(SCPolicyManagementServiceBean.java:513)
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.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
at com.scentric.destiny.bizservice.accesscontrol.auth.SCEJBInterceptor.invoke(SCEJBInterceptor.java:80)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:709)
at sun.reflect.GeneratedMethodAccessor83.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:82)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:197)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
2005-11-10 12:23:22,535 WARN [org.hibernate.util.JDBCExceptionReporter] (RMI TCP Connection(6)-10.0.1.194:) SQL Error: 1054, SQLState: 42S22
2005-11-10 12:23:22,535 ERROR [org.hibernate.util.JDBCExceptionReporter] (RMI TCP Connection(6)-10.0.1.194:) Unknown column 'scpolicygr4_.GROUP_POLICY_VERSION_ID' in 'field list'


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

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.