Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractMethodError when executing CTE query with 1.6.10 and Hibernate ORM 6.4.0.Final #1839

Closed
mkomko opened this issue Nov 24, 2023 · 3 comments · Fixed by #1844
Closed
Assignees
Labels
component: core kind: bug worth: high Implementing this has a high worth
Milestone

Comments

@mkomko
Copy link

mkomko commented Nov 24, 2023

Description

I updated our application to use Hibernate ORM 6.4.0.Final and tested a few things in our application. Executing a CTE query like the following leads to an exception. This is of course not our original query, but I cannot post that here.

@NamedQuery(name = "Object.selectAllParentsInfoRecursive",
        query = "WITH ParentInfoCte AS(" +
                "SELECT p parent, c child, aa.id assignmentId, true directParent, aa.expiryDate expiryDate" +
                "  FROM ... aa " +
                " INNER JOIN aa.parent p" +
                " INNER JOIN aa.child c" +
                "  WHERE c.id = :childId" +
                "   AND aa.validFrom IS NOT NULL" +
                "   AND aa.validTo IS NULL " +
                "UNION ALL " +
                "SELECT p2 parent, c2 child, aa2.id assignmentId, false directParent, NULL expiryDate" +
                "  FROM ParentInfoCte pi " +
                " INNER JOIN ... aa2 on pi.parent = aa2.child " +
                " INNER JOIN aa2.parent p2" +
                " INNER JOIN aa2.child c2" +
                "  WHERE aa2.validFrom IS NOT NULL" +
                "   AND aa2.validTo IS NULL" +
                "   AND c2 != p2" +
                ") search breadth first by parent set orderAttr cycle assignmentId set cycleMark " +
                " SELECT new ParentInfo(pi.parent, pi.child, pi.directParent, pi.assignmentId, pi.expiryDate) " +
                "    FROM ParentInfoCte pi")
List<ParentInfo> resultList =
        em.createNamedQuery("Object.selectAllParentsInfoRecursive", ParentInfo.class)
                .setParameter("childId", adsObject.getId())
                .getResultList();

Expected behavior

The query works and returns the desired results

Actual behavior

The following exception occurs:

Caused by: java.lang.AbstractMethodError: Receiver class com.blazebit.persistence.integration.hibernate.base.function.HibernateJpqlFunctionAdapter does not define or inherit an implementation of the resolved method 'abstract void render(org.hibernate.sql.ast.spi.SqlAppender, java.util.List, org.hibernate.query.ReturnableType, org.hibernate.sql.ast.SqlAstTranslator)' of interface org.hibernate.query.sqm.function.FunctionRenderer.
    at [email protected]//org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression.renderToSql(SelfRenderingFunctionSqlAstExpression.java:184)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitSelfRenderingExpression(AbstractSqlAstTranslator.java:6832)
    at [email protected]//org.hibernate.sql.ast.tree.expression.SelfRenderingExpression.accept(SelfRenderingExpression.java:20)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.render(AbstractSqlAstTranslator.java:6434)
    at [email protected]//org.hibernate.dialect.function.CastingConcatFunction.renderAsString(CastingConcatFunction.java:102)
    at [email protected]//org.hibernate.dialect.function.CastingConcatFunction.render(CastingConcatFunction.java:89)
    at [email protected]//org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression.renderToSql(SelfRenderingFunctionSqlAstExpression.java:184)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitSelfRenderingExpression(AbstractSqlAstTranslator.java:6832)
    at [email protected]//org.hibernate.sql.ast.tree.expression.SelfRenderingExpression.accept(SelfRenderingExpression.java:20)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitRecursivePath(AbstractSqlAstTranslator.java:2500)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.emulateSearchClauseOrderWithString(AbstractSqlAstTranslator.java:2440)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderRecursiveCteVirtualSelections(AbstractSqlAstTranslator.java:2126)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderVirtualSelections(AbstractSqlAstTranslator.java:4837)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitSelectClause(AbstractSqlAstTranslator.java:4731)
    at [email protected]//org.hibernate.dialect.SQLServerSqlAstTranslator.visitSelectClause(SQLServerSqlAstTranslator.java:287)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitQuerySpec(AbstractSqlAstTranslator.java:3180)
    at [email protected]//org.hibernate.dialect.SQLServerSqlAstTranslator.visitQuerySpec(SQLServerSqlAstTranslator.java:277)
    at [email protected]//org.hibernate.sql.ast.tree.select.QuerySpec.accept(QuerySpec.java:119)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.renderQueryGroup(AbstractSqlAstTranslator.java:3105)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitQueryGroup(AbstractSqlAstTranslator.java:3025)
    at [email protected]//org.hibernate.dialect.SQLServerSqlAstTranslator.visitQueryGroup(SQLServerSqlAstTranslator.java:267)
    at [email protected]//org.hibernate.sql.ast.tree.select.QueryGroup.accept(QueryGroup.java:67)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitSelectStatement(AbstractSqlAstTranslator.java:998)
    at [email protected]//org.hibernate.sql.ast.tree.select.SelectStatement.accept(SelectStatement.java:68)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitCteDefinition(AbstractSqlAstTranslator.java:1933)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitCteStatement(AbstractSqlAstTranslator.java:1794)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitCteContainer(AbstractSqlAstTranslator.java:1701)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.visitSelectStatement(AbstractSqlAstTranslator.java:997)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.translateSelect(AbstractSqlAstTranslator.java:861)
    at [email protected]//org.hibernate.sql.ast.spi.AbstractSqlAstTranslator.translate(AbstractSqlAstTranslator.java:811)
    at [email protected]//org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.buildCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:416)
    at [email protected]//org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:310)
    at [email protected]//org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:286)
    at [email protected]//org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:509)
    at [email protected]//org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:427)
    at [email protected]//org.hibernate.query.Query.getResultList(Query.java:120)

Steps to reproduce

I think the problem is a simple incompatibility, so I did not create a reproducer.

Environment

Version: 1.6.10
JPA-Provider: Hibernate 6.4.0.Final
DBMS: Microsoft SQL Server 2019
Application Server: WildFly 30

@ishwariyabooraja
Copy link

Hi @mkomko.
From the stack trace, I could see that there is a method missing in the HibernateJpqlFunctionAdapter class related to the FunctionRenderer interface. This issue is basically encountered when you have incompatible versions of libraries we are using.
Suggestion:
Please try with other versions of balze-persistence and hibernate. It would work.

@mkomko
Copy link
Author

mkomko commented Dec 6, 2023

@ishwariyabooraja Thank you. I know it works with other versions. This issue exists so Blaze Persistence can be made compatible with the newest Hibernate versions 😉

@beikov beikov added this to the 1.6.11 milestone Dec 8, 2023
@beikov beikov self-assigned this Dec 8, 2023
@beikov beikov added kind: bug component: core worth: high Implementing this has a high worth labels Dec 8, 2023
beikov added a commit to beikov/blaze-persistence that referenced this issue Dec 8, 2023
@beikov
Copy link
Member

beikov commented Dec 8, 2023

I'll update to 6.4.1.Final in #1844 and that since the tests require the fix for https://hibernate.atlassian.net/browse/HHH-17466 to work properly. That will happen early next week.

beikov added a commit to beikov/blaze-persistence that referenced this issue Dec 19, 2023
beikov added a commit to beikov/blaze-persistence that referenced this issue Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core kind: bug worth: high Implementing this has a high worth
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants