Giter VIP home page Giter VIP logo

Comments (3)

ar avatar ar commented on June 28, 2024

This is a very good catch and a reminder of a very important issue related to native queries, which are fast, but have some constraints related to composite accounts.

The initial ORM-based query knows that a given account is a child of a given parent correctly using the acct.parent reference. The native queries cut some corners in order to take advantage of the database index, it assumes that the parent shares the acct.code prefix.

What happens here is that the test data has a parent account 11 with children 111,112,113 and 120:

https://github.com/jpos/jPOS-EE/blob/dc905a2a/modules/minigl/src/test/resources/testdata.xml#L52-L66

ORM code considers account 120 as a child of 11 when computing the rule, but native code doesn't.

For the time being, I've changed testdata.xml so that account 120 becomes 114, but the native queries need further work to address this issue or at the very least, GLSession.addAccount should raise an exception if the child's code doesn't start with the same as parent.

Regarding your way of testing this, which is good, there's a simpler one; there's no need to create an hibernate.cfg.xml, you can use just the db-postgresql module and eventually tweak the db.properties file to point to your database. Also, there's now a handy gls.forceDialect(GLSession.NativeDialect.ORM); that you can use in Postgresql (or MySQL) to force the use of the ORM getBalances.

I'm keen to close this issue and open a related one as reminder that native composite balance has this issue, that we need to either fix (without bringing down performance) or at least clearly address in the documentation with a super big warning. Will wait for comments, though.

from jpos-ee.

afk11 avatar afk11 commented on June 28, 2024

Thanks for looking into this! I see, that would explain it. I was aware of that quirk but didn't think of it this time. Quickly tried out replacing 120 with 114 and that passes for me.

Definitely agree on the big warning about the nested account code behaviour in getBalances, and a check in GLSession.addAccount. Should Import.createFinal should perform this check as well, if we provide a way disable the check for legacy systems that have non-canonical account codes but don't use mysql or postgres?

from jpos-ee.

ar avatar ar commented on June 28, 2024

Fully agree on addAcount and Import.createFinal checks.

from jpos-ee.

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.