[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5894) [ENVERS] Loading collections from envers entity fails due to QueryException

Sven Rienstra (JIRA) noreply at atlassian.com
Tue Jun 14 02:30:26 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42579#action_42579 ] 

Sven Rienstra commented on HHH-5894:
------------------------------------

Ok I'll try the solution of adding the audited annotation to the domain field. It might be nice to log some error when this invalid mapping is loaded by envers, especially because this mapping was working in <3.6.0. Anyway thanks for the solution :)

> [ENVERS] Loading collections from envers entity fails due to QueryException
> ---------------------------------------------------------------------------
>
>                 Key: HHH-5894
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5894
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.6.1
>         Environment: Hibernate 3.6.1
> Oracle 10g
> Ubuntu
>            Reporter: Sven Rienstra
>            Assignee: Adam Warski
>            Priority: Blocker
>
> When I'm trying to load a collection from an envers entity it fails due to an incorrect HQL query:
> Caused by: org.hibernate.QueryException: could not resolve property: domein_id of: nl.protopics.zwip.model.gvo.Faq_AUD [select e from nl.protopics.zwip.model.gvo.Faq_AUD e where e.domein_id = :domein_id and e.originalId.REV.id = (select max(e2.originalId.REV.id) from nl.protopics.zwip.model.gvo.Faq_AUD e2 where e2.originalId.REV.id <= :revision and e.originalId.id = e2.originalId.id) and REVTYPE != :delrevisiontype]
> 	at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:81)
> 	at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:75)
> 	at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1465)
> 	at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:315)
> 	at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:487)
> 	at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:611)
> 	at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:263)
> 	at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:210)
> 	at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:117)
> 	at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:113)
> 	at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:880)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1330)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4471)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3944)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2047)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1972)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1972)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:831)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:617)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
> 	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
> 	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
> 	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
> 	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
> 	at org.hibernate.envers.entities.mapper.relation.query.OneAuditEntityQueryGenerator.getQuery(OneAuditEntityQueryGenerator.java:99)
> 	at org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:62)
> 	at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50)
> 	at org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.iterator(CollectionProxy.java:70)
> mappings:
> Domein class, from where I call getFaqs()
> @OneToMany(cascade = CascadeType.ALL, mappedBy = "domein")
> private List<Faq> faqs = new ArrayList<Faq>();
> Faq mapping:
> @ManyToOne
> private Domein domein;
> Works fine with 3.6.0.

-- 
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