Comments (3)
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.
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.
Fully agree on addAcount
and Import.createFinal
checks.
from jpos-ee.
Related Issues (20)
- Incapable of initializing JVM because of ExplicitGCInvokesConcurrentAndUnloadsClasses HOT 3
- Postgresql tests for minigl? HOT 1
- Elasticsearch module - is not working async HOT 1
- Jpos hangs on response 204
- Balance cache is not created till reaches the safe window HOT 2
- Status hbm references non existent status column from SysLog HOT 4
- Unable to create slave databases in windows environment HOT 4
- Change visibility of ChannelMonitor's cfg and servicename to protected HOT 2
- Change DTD used from the SourceForge one to the hibernate one HOT 4
- Use try with resource to close Socket in Ping.java
- Use try with resource to close FileReader in DB.java
- Make the Debug participant extend the doPrepare(...) method to get profile dump the debug participant's timing info HOT 4
- QRest - handle headers greater than 8192 bytes (default)
- Consider upgrading Jetty to 10.x or 11.x
- A lot of check methods are not going through the entire list of params for validation HOT 3
- Let DB properties be loaded from resource path
- Logback 1.3.x is for java 8 and 1.4.x is for java 11 HOT 2
- QRest SendResponse participant does not send response in the prepare method HOT 2
- [QREST] Make the txn mgr space timeout per route
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jpos-ee.