[jira] [Closed] (CAY-2575) Select translator: Wrong translation of IN Expression
[ https://issues.apache.org/jira/browse/CAY-2575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Nikita Timofeev closed CAY-2575. Resolution: Fixed https://github.com/apache/cayenne/commit/90c19b0c18614346eb110265da2780caaa84dc09 > Select translator: Wrong translation of IN Expression > - > > Key: CAY-2575 > URL: https://issues.apache.org/jira/browse/CAY-2575 > Project: Cayenne > Issue Type: Bug > Components: Core Library >Reporter: Nikita Timofeev >Assignee: Nikita Timofeev >Priority: Major > Fix For: 4.2.M1 > > > Expression like: {{a < 2 and b in (5,6) and b = 7}} > Translates to: {{( ( t0.a < 2 ) AND t0.b IN ( 5, 6) ) ( t0.b = 7 )}}, note > missing *AND*. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[cayenne] branch master updated: CAY-2575 Select translator: Wrong translation of IN Expression
This is an automated email from the ASF dual-hosted git repository. ntimofeev pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git The following commit(s) were added to refs/heads/master by this push: new 90c19b0 CAY-2575 Select translator: Wrong translation of IN Expression 90c19b0 is described below commit 90c19b0c18614346eb110265da2780caaa84dc09 Author: Nikita Timofeev AuthorDate: Thu May 2 16:42:16 2019 +0300 CAY-2575 Select translator: Wrong translation of IN Expression --- RELEASE-NOTES.txt | 1 + .../translator/select/QualifierTranslator.java | 22 -- .../translator/select/QualifierTranslatorTest.java | 22 ++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index bf53690..586d743 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -51,6 +51,7 @@ CAY-2553 Wrong disjoint prefetch query qualifier CAY-2559 Modeler: Warning dialog shows wrong information after changing target entity in dbRelationship CAY-2561 Modeler: cgen type combobox doesn't set templates CAY-2572 Queries are not sorted by name in data map XML +CAY-2575 Select translator: Wrong translation of IN Expression -- Release: 4.1.B1 diff --git a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/QualifierTranslator.java b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/QualifierTranslator.java index d48a53f..206996b 100644 --- a/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/QualifierTranslator.java +++ b/cayenne-server/src/main/java/org/apache/cayenne/access/translator/select/QualifierTranslator.java @@ -297,13 +297,31 @@ class QualifierTranslator implements TraversalHandler { return expressionNodeBuilder.build(); } +private boolean nodeProcessed(Expression node) { +// must be in sync with expressionNodeToSqlNode() method +switch (node.getType()) { +case NOT_IN: case IN: case NOT_BETWEEN: case BETWEEN: case NOT: +case BITWISE_NOT: case EQUAL_TO: case NOT_EQUAL_TO: case LIKE: case NOT_LIKE: +case LIKE_IGNORE_CASE: case NOT_LIKE_IGNORE_CASE: case OBJ_PATH: case DB_PATH: +case FUNCTION_CALL: case ADD: case SUBTRACT: case MULTIPLY: case DIVIDE: case NEGATIVE: +case BITWISE_AND: case BITWISE_LEFT_SHIFT: case BITWISE_OR: case BITWISE_RIGHT_SHIFT: case BITWISE_XOR: +case OR: case AND: case LESS_THAN: case LESS_THAN_EQUAL_TO: case GREATER_THAN: case GREATER_THAN_EQUAL_TO: +case TRUE: case FALSE: case ASTERISK: case EXISTS: case SUBQUERY: case ENCLOSING_OBJECT: case FULL_OBJECT: +return true; +} +return false; +} + @Override public void endNode(Expression node, Expression parentNode) { if(expressionsToSkip.contains(node) || expressionsToSkip.contains(parentNode)) { return; } -if(currentNode.getParent() != null) { -currentNode = currentNode.getParent(); + +if(nodeProcessed(node)) { +if (currentNode.getParent() != null) { +currentNode = currentNode.getParent(); +} } } diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorTest.java b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorTest.java index 45116cf..be802c4 100644 --- a/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorTest.java +++ b/cayenne-server/src/test/java/org/apache/cayenne/access/translator/select/QualifierTranslatorTest.java @@ -22,6 +22,8 @@ package org.apache.cayenne.access.translator.select; import java.util.Arrays; import org.apache.cayenne.CayenneRuntimeException; +import org.apache.cayenne.access.sqlbuilder.SQLGenerationVisitor; +import org.apache.cayenne.access.sqlbuilder.StringBuilderAppendable; import org.apache.cayenne.access.sqlbuilder.sqltree.BetweenNode; import org.apache.cayenne.access.sqlbuilder.sqltree.BitwiseNotNode; import org.apache.cayenne.access.sqlbuilder.sqltree.ColumnNode; @@ -80,6 +82,12 @@ public class QualifierTranslatorTest { attribute.setName("a"); attribute.setDbAttributePath("a"); entity.addAttribute(attribute); + +ObjAttribute attribute2 = new ObjAttribute(); +attribute2.setName("b"); +attribute2.setDbAttributePath("b"); +entity.addAttribute(attribute2); + entity.setDbEntity(dbEntity); DataMap dataMap = new DataMap(); @@ -451,6 +459,20 @@ public class QualifierTranslatorTest { } @Test +public void translateComplexAnd() { +Node and = translate("a < 2 and b in (5,6) and b = 7"); +assertNotNull(and); + +
[jira] [Created] (CAY-2575) Select translator: Wrong translation of IN Expression
Nikita Timofeev created CAY-2575: Summary: Select translator: Wrong translation of IN Expression Key: CAY-2575 URL: https://issues.apache.org/jira/browse/CAY-2575 Project: Cayenne Issue Type: Bug Components: Core Library Reporter: Nikita Timofeev Assignee: Nikita Timofeev Fix For: 4.2.M1 Expression like: {{a < 2 and b in (5,6) and b = 7}} Translates to: {{( ( t0.a < 2 ) AND t0.b IN ( 5, 6) ) ( t0.b = 7 )}}, note missing *AND*. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Closed] (CAY-2551) Create extended type for abstract Number class
[ https://issues.apache.org/jira/browse/CAY-2551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arseni Bulatski closed CAY-2551. Resolution: Won't Do > Create extended type for abstract Number class > -- > > Key: CAY-2551 > URL: https://issues.apache.org/jira/browse/CAY-2551 > Project: Cayenne > Issue Type: Task > Components: Core Library >Reporter: Arseni Bulatski >Assignee: Arseni Bulatski >Priority: Major > Fix For: 4.2.M1 > > Time Spent: 20m > Remaining Estimate: 0h > > Need to create extended type for abstract Number class. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] [cayenne] aarrsseni closed pull request #376: CAY-2551 Create extended type for abstract Number class
aarrsseni closed pull request #376: CAY-2551 Create extended type for abstract Number class URL: https://github.com/apache/cayenne/pull/376 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[jira] [Updated] (CAY-2338) Support comments in cgen and default templates
[ https://issues.apache.org/jira/browse/CAY-2338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arseni Bulatski updated CAY-2338: - Description: Now cgen module is created for each generation. Prepare stage for this task: * add cgen module with other modules when modeler is starting > Support comments in cgen and default templates > -- > > Key: CAY-2338 > URL: https://issues.apache.org/jira/browse/CAY-2338 > Project: Cayenne > Issue Type: Sub-task > Components: cgen, Modeler, Non-GUI Tools >Reporter: Nikita Timofeev >Priority: Major > Fix For: 4.2.M1 > > > Now cgen module is created for each generation. > Prepare stage for this task: > * add cgen module with other modules when modeler is starting -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CAY-2574) FronBase integration issues
[ https://issues.apache.org/jira/browse/CAY-2574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Nikita Timofeev updated CAY-2574: - Description: Here are known problems with {{FronBase}} DB integration in Cayenne: * FronBase jdbc driver incorrectly returns {{null}} instead of statement (or throwing SQLException at least) when {{connection.prepareStatement(sql, Statement.NO_GENERATED_KEYS)}} is called. We have simple workaround for this: just call {{connection.prepareStatement(sql)}}. But it would be better if driver could do this for us, and there could be other places that do not follow JDBC specification as we can't run all tests, see second issue. * Driver randomly hangs on socket read operation, see attached image for stack trace. This happens on every run of Cayenne tests (see short instructions below) !Screen Shot 2019-04-12 at 14.44.30.png! Short instructions for running Cayenne tests against FrontBase DB: * install FB JDBC driver to local maven repo {code:java} $ mvn install:install-file -Dfile=frontbasejdbc.jar -DgroupId=com.frontbase \ -DartifactId=frontbase-driver -Dversion=4.1 -Dpackaging=jar -DgeneratePom=true {code} * clone Cayenne repo {code:java} $ git clone https://github.com/apache/cayenne.git $ cd cayenne {code} * run tests {code:java} $ mvn verify -DcayenneTestConnection=frontbase \ -DcayenneAdapter=org.apache.cayenne.dba.frontbase.FrontBaseAdapter \ -DcayenneJdbcUsername=_system \ -DcayenneJdbcUrl=jdbc:frontbase://localhost/test \ -DcayenneJdbcDriver=com.frontbase.jdbc.FBJDriver {code} See additional details [here|https://cayenne.apache.org/dev/running-unit-tests.html] was: Here are known problems with {{FronBase}} DB integration in Cayenne: * FronBase jdbc driver incorrectly returns {{null}} instead of statement (or throwing SQLException at least) when {{connection.prepareStatement(sql, Statement.NO_GENERATED_KEYS)}} is called. We have simple workaround for this: just call {{connection.prepareStatement(sql)}}. But it would be better if driver could do this for us, and there could be other places that do not follow JDBC specification as we can't run all tests, see second issue. * Driver randomly hangs on socket read operation, see attached image for stack trace. This happens on every run of Cayenne tests (like just call {{mvn verify}} with FrontBase connection) !Screen Shot 2019-04-12 at 14.44.30.png! > FronBase integration issues > --- > > Key: CAY-2574 > URL: https://issues.apache.org/jira/browse/CAY-2574 > Project: Cayenne > Issue Type: Bug > Components: Database integration >Affects Versions: 4.0.1, 4.1.B1 > Environment: FronBase >Reporter: Nikita Timofeev >Priority: Minor > Attachments: Screen Shot 2019-04-12 at 14.44.30.png > > > Here are known problems with {{FronBase}} DB integration in Cayenne: > * FronBase jdbc driver incorrectly returns {{null}} instead of statement (or > throwing SQLException at least) when {{connection.prepareStatement(sql, > Statement.NO_GENERATED_KEYS)}} is called. > We have simple workaround for this: just call > {{connection.prepareStatement(sql)}}. But it would be better if driver could > do this for us, and there could be other places that do not follow JDBC > specification as we can't run all tests, see second issue. > * Driver randomly hangs on socket read operation, see attached image for > stack trace. > This happens on every run of Cayenne tests (see short instructions below) > !Screen Shot 2019-04-12 at 14.44.30.png! > Short instructions for running Cayenne tests against FrontBase DB: > * install FB JDBC driver to local maven repo > {code:java} > $ mvn install:install-file -Dfile=frontbasejdbc.jar -DgroupId=com.frontbase \ >-DartifactId=frontbase-driver -Dversion=4.1 -Dpackaging=jar > -DgeneratePom=true > {code} > * clone Cayenne repo > {code:java} > $ git clone https://github.com/apache/cayenne.git > $ cd cayenne > {code} > * run tests > {code:java} > $ mvn verify -DcayenneTestConnection=frontbase \ >-DcayenneAdapter=org.apache.cayenne.dba.frontbase.FrontBaseAdapter \ >-DcayenneJdbcUsername=_system \ >-DcayenneJdbcUrl=jdbc:frontbase://localhost/test \ >-DcayenneJdbcDriver=com.frontbase.jdbc.FBJDriver > {code} > See additional details > [here|https://cayenne.apache.org/dev/running-unit-tests.html] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Updated] (CAY-2574) FronBase integration issues
[ https://issues.apache.org/jira/browse/CAY-2574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Nikita Timofeev updated CAY-2574: - Description: Here are known problems with {{FronBase}} DB integration in Cayenne: * FronBase jdbc driver incorrectly returns {{null}} instead of statement (or throwing SQLException at least) when {{connection.prepareStatement(sql, Statement.NO_GENERATED_KEYS)}} is called. We have simple workaround for this: just call {{connection.prepareStatement(sql)}}. But it would be better if driver could do this for us, and there could be other places that do not follow JDBC specification as we can't run all tests, see second issue. * Driver randomly hangs on socket read operation, see attached image for stack trace. This happens on every run of Cayenne tests (like just call {{mvn verify}} with FrontBase connection) !Screen Shot 2019-04-12 at 14.44.30.png! was: Here are known problems with {{FronBase}} DB integration in Cayenne: * FronBase jdbc driver incorrectly returns {{null}} when {{connection.prepareStatement(sql, Statement.NO_GENERATED_KEYS)}} is called. * Driver randomly hangs on socket read operation, see attached image for stack trace. !Screen Shot 2019-04-12 at 14.44.30.png! > FronBase integration issues > --- > > Key: CAY-2574 > URL: https://issues.apache.org/jira/browse/CAY-2574 > Project: Cayenne > Issue Type: Bug > Components: Database integration >Affects Versions: 4.0.1, 4.1.B1 > Environment: FronBase >Reporter: Nikita Timofeev >Priority: Minor > Attachments: Screen Shot 2019-04-12 at 14.44.30.png > > > Here are known problems with {{FronBase}} DB integration in Cayenne: > * FronBase jdbc driver incorrectly returns {{null}} instead of statement (or > throwing SQLException at least) when {{connection.prepareStatement(sql, > Statement.NO_GENERATED_KEYS)}} is called. > We have simple workaround for this: just call > {{connection.prepareStatement(sql)}}. But it would be better if driver could > do this for us, and there could be other places that do not follow JDBC > specification as we can't run all tests, see second issue. > * Driver randomly hangs on socket read operation, see attached image for > stack trace. > This happens on every run of Cayenne tests (like just call {{mvn verify}} > with FrontBase connection) > !Screen Shot 2019-04-12 at 14.44.30.png! > -- This message was sent by Atlassian JIRA (v7.6.3#76005)