Coder Social home page Coder Social logo

Comments (3)

jwgmeligmeyling avatar jwgmeligmeyling commented on July 1, 2024

IIRC there is a test that tests exactly this, so I am wondering if this may actually be a Hibernate 6.2 issue as Blaze Persistence renders set operations natively in Hibernate 6.🤔

Did you try with a plain Blaze-Persistence CriteriaBuilder query or a HQL query directly?

from blaze-persistence.

beikov avatar beikov commented on July 1, 2024

The generated query is:

(
	SELECT DISTINCT entity1.brand AS brand FROM ENTITY entity1 WHERE lower(entity1.brand) LIKE :param_0 ESCAPE '!' LIMIT 100 
	UNION 
	SELECT DISTINCT entity2.brand AS brand FROM ENTITY entity2 WHERE lower(entity2.brand) LIKE :param_1 ESCAPE '!'
) 
ORDER BY brand ASC

Seems the QueryDSL integration might apply the limit on the wrong node maybe. Can you check that please @jwgmeligmeyling?

from blaze-persistence.

jwgmeligmeyling avatar jwgmeligmeyling commented on July 1, 2024
SetExpression<Document> query = queryFactory
        .union(
                queryFactory.intersect(
                        select(document).from(document).where(document.id.eq(41L)).limit(1),
                        queryFactory.except(
                                select(document).from(document).where(document.id.eq(42L)).limit(2),
                                select(document).from(document).where(document.id.eq(43L)).limit(3)
                        ).limit(4)
                ).limit(5),
                select(document).from(document).where(document.id.eq(46L)).limit(6)
        )
        .limit(7);

produces the following JPQL Next:

((SELECT document FROM Document document WHERE document.id = :param_0 LIMIT 1
INTERSECT
((SELECT document FROM Document document WHERE document.id = :param_1 LIMIT 2
EXCEPT
SELECT document FROM Document document WHERE document.id = :param_2 LIMIT 3) LIMIT 4)) LIMIT 5)
UNION
SELECT document FROM Document document WHERE document.id = :param_3 LIMIT 6

Although the outermost limit doesn't seem to be applied, I don't see the outermost limit being applied to any of the subqueries.

I think the error is not from the exact query from the original issue.

Even though the outer most limit is not applied, the serializer always produced valid JPQL which leads me to believe there is another issue somewhere still.

from blaze-persistence.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.