org.hibernate.hql.ast.QuerySyntaxException: BKG_BKCMR_REL_AUD is not mapped [select new list(ee, e) from BKG_BKCMR_REL_AUD ee, *package-name-omitted*.BookingComponent_AUD e where ee.originalId.BookingComponent_id = e.originalId.id and ee.originalId.children_id = :children_id and e.originalId.rev_id.id <= :revision and ee.originalId.rev_id.id <= :revision and ee.rev_type != :delrevisiontype and e.rev_type != :delrevisiontype and (e.REV_ID_END.id > :revision or e.REV_ID_END is null) and (ee.REV_ID_END.id > :revision or ee.REV_ID_END is null)]

Hibernate JIRA | Gerard Krupa | 5 years ago
  1. 0

    We have a parent-child relationship set up for an entity using a plain link table. This is annotated with @JoinTable and @AuditJoinTable so there is no entity for the link table itself. The definition looks something like this... @Entity @Table(name = "BKG_BKCM_BKG_CMPT") @Audited public class BookingComponent implements Serializable { @ManyToOne(fetch = FetchType.LAZY, optional = true) @AuditJoinTable(name = "BKG_BKCMR_REL_AUD", inverseJoinColumns = { @JoinColumn(name = "BKCM_ID_PARENT", nullable = true, updatable = false) }) @JoinTable(name = "BKG_BKCMR_REL", joinColumns = { @JoinColumn(name = "BKCM_ID_CHILD", nullable = true, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "BKCM_ID_PARENT", nullable = true, updatable = false) }) private BookingComponent parent; @OneToMany(mappedBy = "parent") private List<BookingComponent> children; } We've found two issues. Firstly, when we try to retrieve a previous revision of these entities (they in turn are held in a collection in a container entity) using List<>.size() Envers seems to be constructing a JPQL query using the link table's table name which isn't valid JPQL resulting in the following exception: org.hibernate.hql.ast.QuerySyntaxException: BKG_BKCMR_REL_AUD is not mapped [select new list(ee, e) from BKG_BKCMR_REL_AUD ee, *package-name-omitted*.BookingComponent_AUD e where ee.originalId.BookingComponent_id = e.originalId.id and ee.originalId.children_id = :children_id and e.originalId.rev_id.id <= :revision and ee.originalId.rev_id.id <= :revision and ee.rev_type != :delrevisiontype and e.rev_type != :delrevisiontype and (e.REV_ID_END.id > :revision or e.REV_ID_END is null) and (ee.REV_ID_END.id > :revision or ee.REV_ID_END is null)] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:327) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) 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.TwoEntityQueryGenerator.getQuery(TwoEntityQueryGenerator.java:128) 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.size(CollectionProxy.java:55) We've also noticed that the audit entries for the link table have a null REV_ID_END despite there being multiple revisions. See attached gjkrupa_envers_problem.zip for a test case that demonstrates this issue.

    Hibernate JIRA | 5 years ago | Gerard Krupa
    org.hibernate.hql.ast.QuerySyntaxException: BKG_BKCMR_REL_AUD is not mapped [select new list(ee, e) from BKG_BKCMR_REL_AUD ee, *package-name-omitted*.BookingComponent_AUD e where ee.originalId.BookingComponent_id = e.originalId.id and ee.originalId.children_id = :children_id and e.originalId.rev_id.id <= :revision and ee.originalId.rev_id.id <= :revision and ee.rev_type != :delrevisiontype and e.rev_type != :delrevisiontype and (e.REV_ID_END.id > :revision or e.REV_ID_END is null) and (ee.REV_ID_END.id > :revision or ee.REV_ID_END is null)]
  2. 0

    We have a parent-child relationship set up for an entity using a plain link table. This is annotated with @JoinTable and @AuditJoinTable so there is no entity for the link table itself. The definition looks something like this... @Entity @Table(name = "BKG_BKCM_BKG_CMPT") @Audited public class BookingComponent implements Serializable { @ManyToOne(fetch = FetchType.LAZY, optional = true) @AuditJoinTable(name = "BKG_BKCMR_REL_AUD", inverseJoinColumns = { @JoinColumn(name = "BKCM_ID_PARENT", nullable = true, updatable = false) }) @JoinTable(name = "BKG_BKCMR_REL", joinColumns = { @JoinColumn(name = "BKCM_ID_CHILD", nullable = true, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "BKCM_ID_PARENT", nullable = true, updatable = false) }) private BookingComponent parent; @OneToMany(mappedBy = "parent") private List<BookingComponent> children; } We've found two issues. Firstly, when we try to retrieve a previous revision of these entities (they in turn are held in a collection in a container entity) using List<>.size() Envers seems to be constructing a JPQL query using the link table's table name which isn't valid JPQL resulting in the following exception: org.hibernate.hql.ast.QuerySyntaxException: BKG_BKCMR_REL_AUD is not mapped [select new list(ee, e) from BKG_BKCMR_REL_AUD ee, *package-name-omitted*.BookingComponent_AUD e where ee.originalId.BookingComponent_id = e.originalId.id and ee.originalId.children_id = :children_id and e.originalId.rev_id.id <= :revision and ee.originalId.rev_id.id <= :revision and ee.rev_type != :delrevisiontype and e.rev_type != :delrevisiontype and (e.REV_ID_END.id > :revision or e.REV_ID_END is null) and (ee.REV_ID_END.id > :revision or ee.REV_ID_END is null)] at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180) at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111) at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93) at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:327) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325) at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584) 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.TwoEntityQueryGenerator.getQuery(TwoEntityQueryGenerator.java:128) 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.size(CollectionProxy.java:55) We've also noticed that the audit entries for the link table have a null REV_ID_END despite there being multiple revisions. See attached gjkrupa_envers_problem.zip for a test case that demonstrates this issue.

    Hibernate JIRA | 5 years ago | Gerard Krupa
    org.hibernate.hql.ast.QuerySyntaxException: BKG_BKCMR_REL_AUD is not mapped [select new list(ee, e) from BKG_BKCMR_REL_AUD ee, *package-name-omitted*.BookingComponent_AUD e where ee.originalId.BookingComponent_id = e.originalId.id and ee.originalId.children_id = :children_id and e.originalId.rev_id.id <= :revision and ee.originalId.rev_id.id <= :revision and ee.rev_type != :delrevisiontype and e.rev_type != :delrevisiontype and (e.REV_ID_END.id > :revision or e.REV_ID_END is null) and (ee.REV_ID_END.id > :revision or ee.REV_ID_END is null)]
  3. 0

    川哥,apdPlat在myeclipse 10下启动时报错了,求救啊!!

    GitHub | 3 years ago | changong28
    java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: IndexScheduleConfig is not mapped [select o from IndexScheduleConfig o order by o.id desc]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 26#20792518

    GitHub | 3 years ago | huacxl
    java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: IndexScheduleConfig is not mapped [select o from IndexScheduleConfig o order by o.id desc]
  6. 0

    GitHub comment 26#20859795

    GitHub | 3 years ago | huacxl
    java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: IndexScheduleConfig is not mapped [select o from IndexScheduleConfig o order by o.id desc]

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.hql.ast.QuerySyntaxException

      BKG_BKCMR_REL_AUD is not mapped [select new list(ee, e) from BKG_BKCMR_REL_AUD ee, *package-name-omitted*.BookingComponent_AUD e where ee.originalId.BookingComponent_id = e.originalId.id and ee.originalId.children_id = :children_id and e.originalId.rev_id.id <= :revision and ee.originalId.rev_id.id <= :revision and ee.rev_type != :delrevisiontype and e.rev_type != :delrevisiontype and (e.REV_ID_END.id > :revision or e.REV_ID_END is null) and (ee.REV_ID_END.id > :revision or ee.REV_ID_END is null)]

      at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister()
    2. Hibernate
      SessionFactoryHelper.requireClassPersister
      1. org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
      1 frame
    3. Hibernate HQL/JP-QL Parser
      HqlSqlWalker.createFromElement
      1. org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111)
      2. org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
      3. org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:327)
      3 frames
    4. Hibernate
      HqlSqlBaseWalker.statement
      1. org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441)
      2. org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325)
      3. org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733)
      4. org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584)
      5. org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
      6. org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
      6 frames
    5. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.compile
      1. org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
      2. org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
      3. org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
      3 frames
    6. Hibernate
      SessionImpl.createQuery
      1. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
      2. org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
      3. org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
      4. org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
      5. org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
      6. org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
      6 frames
    7. A Hibernate O/RM Module
      CollectionProxy.size
      1. org.hibernate.envers.entities.mapper.relation.query.TwoEntityQueryGenerator.getQuery(TwoEntityQueryGenerator.java:128)
      2. org.hibernate.envers.entities.mapper.relation.lazy.initializor.AbstractCollectionInitializor.initialize(AbstractCollectionInitializor.java:62)
      3. org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.checkInit(CollectionProxy.java:50)
      4. org.hibernate.envers.entities.mapper.relation.lazy.proxy.CollectionProxy.size(CollectionProxy.java:55)
      4 frames