Sleeping unexpected end of subtree while working with a collection of basics

I have the following object:


@Entity
public class AnalysisPolicy extends PersistentEntity{
    private Set nodeIds;
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(
        name="analysis_policy_nodes",
        joinColumns=@JoinColumn(name="analysis_policy_id")
)
@Column(name="node_id")
public Set<Long> getNodeIds() {
    return nodeIds;
}

} code>

and im will try the following JPQL query:


select p from AnalysisPolicy p where p.nodeIds is not empty

The result looks something like this:


10:11:16,665 DEBUG [org.hibernate.hql.ast.AST] --- SQL AST ---
 -[SELECT] QueryNode: 'SELECT'  querySpaces (AnalysisPolicy,analysis_policy_nodes)
    +-[SELECT_CLAUSE] SelectClause: '{select clause}'
    |  -[ALIAS_REF] IdentNode: 'analysispo0_.f_id as f1_8_' {alias=p, className=com.emc.dpa.datamodel.analysis.AnalysisPolicy, tableAlias=analysispo0_}
    +-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[p], fromElementByTableAlias=[analysispo0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
    |  -[FROM_FRAGMENT] FromElement: 'AnalysisPolicy analysispo0_' FromElement{explicit,collection join,not a fetch join,fetch non-lazy properties,classAlias=p,role=null,tableName=AnalysisPolicy,tableAlias=analysispo0_,origin=null,columns={,className=com.emc.dpa.datamodel.analysis.AnalysisPolicy}}
    -[WHERE] SqlNode: 'where'
       -[EXISTS] UnaryLogicOperatorNode: 'exists'
          -[SELECT] QueryNode: 'SELECT'  querySpaces (AnalysisPolicy,analysis_policy_nodes)
             +-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
             +-[FROM] FromClause: 'from' FromClause{level=2, fromElementCounter=0, fromElements=1, fromElementByClassAlias=[], fromElementByTableAlias=[nodeids1_], fromElementsByPath=[], collectionJoinFromElementsByPath=[p.nodeIds], impliedElements=[]}
             |  -[FROM_FRAGMENT] ImpliedFromElement: 'analysis_policy_nodes nodeids1_' ImpliedFromElement{implied,collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=com.emc.dpa.datamodel.analysis.AnalysisPolicy.nodeIds,tableName={none},tableAlias=nodeids1_,origin=AnalysisPolicy analysispo0_,columns={,className=null}}
             -[WHERE] SqlNode: 'WHERE'
                -[THETA_JOINS] SqlNode: '{theta joins}'
                   -[SQL_TOKEN] SqlFragment: 'analysispo0_.f_id=nodeids1_.analysis_policy_id'

10: 11: 16,681 DEBUG [org.hibernate.hql.ast.ErrorCounter] throwQueryException (): no errors 10: 11: 16,712 ERROR [org.hibernate.hql.PARSER]: 0: 0: unexpected end of subtree

. stackoverflow , , , , , , " " " - . , " null" . "size (nodeIds) > 1" , SQL , .

? (, "" ).

+5
2

HQL , Hibernate JPQL:

select p from AnalysisPolicy p where exists elements(p.nodeIds)

. :

+7

:

select p from AnalysisPolicy as p join p.nodeIds group by p
0

All Articles