Giter Club home page Giter Club logo

Comments (4)

Leyart avatar Leyart commented on July 21, 2024

Handled in #461

from datanucleus-rdbms.

andyjefferson avatar andyjefferson commented on July 21, 2024

Yes, all query extensions are stored internally in lowercase (and should automatically be available in QueryToSQLMapper in lowercase, so no need to convert) ... and this is because they have to be stored in one case and are intended to be case insensitive, hence store in lower and check against lower.

If that specific extension is the problem then you should look at
https://github.com/datanucleus/datanucleus-rdbms/blob/master/src/main/java/org/datanucleus/store/rdbms/query/QueryToSQLMapper.java#L5157
and simply look at putting the "alias" in lowercase before the lookup.

from datanucleus-rdbms.

Leyart avatar Leyart commented on July 21, 2024

Thanks for the feedback. I am reporting this because prior to DN 6, the casing for variables used in JDOQL query expression did not matter.
The problem is not that the extension should be defined lowercase.
The problem is that when defining variables in query expressions, we are forced to have them in lowercase or join extensions will not work correctly anymore.

The join extension is NOT picked up in the following cases:

  • The variable provided in the query is in camelCase and the extension that references it in camelCase
  • The variable provided in the query is in camelCase and the extension that references it in lowercase

Here test-jdo.zip is a small example showing the unexpected behavior.

It seems that in QueryToSQLMapper the alias is actually picked up from the query variable name in the query expression.

In the provided test the path seems to be:
https://github.com/datanucleus/datanucleus-rdbms/blob/master/src/main/java/org/datanucleus/store/rdbms/query/QueryToSQLMapper.java#L2846 <-- This is where the Alias is picked up from the query expression

public JoinType getRequiredJoinTypeForAlias(String alias)

And at this point the extension is generated using the fully cased alias, which cannot be found in the extensionsByName map.

Thanks a lot for checking this out and sorry if my initial issue description was not clear enough.

from datanucleus-rdbms.

Leyart avatar Leyart commented on July 21, 2024

I updated the pull request with the correct fix, that makes the tests in my POC pass correctly and is less invasive than the previous one

from datanucleus-rdbms.

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.