[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3901) Problem to query with generated columns: Illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]

Debabrata Dey (JIRA) noreply at atlassian.com
Wed May 6 18:22:13 EDT 2009


Problem to query with generated columns: Illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-3901
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3901
             Project: Hibernate Core
          Issue Type: Bug
          Components: query-hql
    Affects Versions: 3.2.4.sp1
         Environment: Hibernate 3.2.4.sp1; 
Database server = DB2/LINUXX8664 9.5.0
JDK: 1.5.0_14-b03
            Reporter: Debabrata Dey


This issue occurs when upgrading to version 3.2.4_sp1. It works absolutely fine with version 3.2.1 <Three similar cases fail when using Hibernate version 3.2.4.sp1. 
Error:
illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]

org.hibernate.QueryException: illegal attempt to dereference collection [agent0_.agentid.roleSet] with element property reference [roleName_up] [from com.Agent a where a.roleSet.roleName_up = :role AND a.status not in (:status) ]
at org.hibernate.hql.ast.tree.DotNode$1.buildIllegalCollectionDereferenceException(DotNode.java:46)
at org.hibernate.hql.ast.tree.DotNode.checkLhsIsNotCollection(DotNode.java:512)
at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:221)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:728)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1216)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3525)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at com.DAOImp.AgentDAOImp.findAgentByCriteria(AgentDAOImp.java:388)


Agent a has a roleSet defined like this - 
private Set roleSet;
@ManyToMany(targetEntity = SecurityRole.class, cascade={}, fetch= FetchType.LAZY)
@JoinTable(name="AGENTROLE", joinColumns={@JoinColumn(name="AGENTID")}, inverseJoinColumns={@JoinColumn(name="SECURITYROLEID")})
    public Set getRoleSet() {
        return roleSet;
    } 

SecurityRole has attribute roleName_up which maps to a generated column value like this.
@Column(name="roleName_up", insertable=false, updatable=false)
	@Generated(value = GenerationTime.ALWAYS)
	public String getRoleName_up() {
		return roleName_up;
	}



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list