You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Pinaki Poddar (JIRA)" <ji...@apache.org> on 2011/04/12 22:34:05 UTC

[jira] [Created] (OPENJPA-1979) Regression for non-standard joins with constant column values

Regression for non-standard joins with constant column values 
--------------------------------------------------------------

                 Key: OPENJPA-1979
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc, kernel
    Affects Versions: 2.0.0, 2.0.0-M1
            Reporter: Pinaki Poddar
             Fix For: 2.1.0


The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   

The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "Michael Spiro (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13121919#comment-13121919 ] 

Michael Spiro commented on OPENJPA-1979:
----------------------------------------

I opened a duplicate issue OPENJPA-2054.

Pinaki, your patch handles only the case with a string constant but doesn`t handle numeric constants (beginning with a digit, a dot or a minus sign). "Null" should also be considered a constant. Shouldn't this be added? I think the parsing logic should be the same as in MappingInfo.mergeJoinColumn().
                
> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>         Attachments: OPENJPA-1979.patch.1.txt, Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-1979:
-----------------------------------

    Attachment: OPENJPA-1979.patch.1.txt

This is a patch to fix the problem. 
WARNING: Only partially tested.

> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>             Fix For: 2.1.0
>
>         Attachments: OPENJPA-1979.patch.1.txt, Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-1979:
----------------------------------

    Fix Version/s:     (was: 2.1.0)

> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>         Attachments: OPENJPA-1979.patch.1.txt, Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "David Minor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13283824#comment-13283824 ] 

David Minor commented on OPENJPA-1979:
--------------------------------------

A similar fix is also needed for 'private static Column newColumn(ElementJoinColumn join, boolean delimit)', and possibly the other join annotations if they used to support constant joins.
                
> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>         Attachments: OPENJPA-1979.patch.1.txt, Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "Francois (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13280090#comment-13280090 ] 

Francois commented on OPENJPA-1979:
-----------------------------------

Hi.

I checked out version 2.2.0 and found that this patch wasn't applied yet.
Based on Micael's question, I modified the method as follows and I can confirm that it worked with constant values as numbers and text:

private Column newColumn(JoinColumn join) {
        Column col = new Column();
        if (!StringUtils.isEmpty(join.name()))
            col.setIdentifier(DBIdentifier.newColumn(join.name(), delimit()));
        if (!StringUtils.isEmpty(join.columnDefinition()))
            col.setTypeIdentifier(DBIdentifier.newColumnDefinition(join.columnDefinition()));
//        if (!StringUtils.isEmpty(join.referencedColumnName())) //f fix from openjpa-1979
//            col.setTargetIdentifier(DBIdentifier.newColumn(join.referencedColumnName(), delimit()));
        String joinColumnName = join.referencedColumnName();
        if (!StringUtils.isEmpty(joinColumnName)) {
            boolean isConstant = joinColumnName.charAt(0) == '\'';
            if(!isConstant){
                if (joinColumnName.charAt(0) == '-'
                    || joinColumnName.charAt(0) == '.'
                    || Character.isDigit(joinColumnName.charAt(0))) {
                    isConstant = true;
                    try {
                        if (joinColumnName.indexOf('.') == -1){
                            new Integer(joinColumnName);
                        } else{
                            new Double(joinColumnName);
                        }
                    } catch (NumberFormatException nfe) {
                        throw new RuntimeException("Constant Join Column is not a Valid Number: " + joinColumnName
                                + ", Join: " + join);
                    }
                } else if ("null".equalsIgnoreCase(joinColumnName)){
                    isConstant = true;
                }
            }

            if (isConstant) {
                col.setTargetIdentifier(DBIdentifier.newConstant(joinColumnName));
            } else {
                col.setTargetIdentifier(DBIdentifier.newColumn(joinColumnName, delimit()));
            }
        }
        col.setNotNull(!join.nullable());
        col.setFlag(Column.FLAG_UNINSERTABLE, !join.insertable());
        col.setFlag(Column.FLAG_UNUPDATABLE, !join.updatable());
        return col;
    }
                
> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>         Attachments: OPENJPA-1979.patch.1.txt, Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019040#comment-13019040 ] 

Jeremy Bauer commented on OPENJPA-1979:
---------------------------------------

Hey Pinaki.  Your patch looks good to me.  We may need to look at the XML mapping parser as well.  It looks like we were sorely lacking a jUnit for this scenario...

> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>             Fix For: 2.1.0
>
>         Attachments: OPENJPA-1979.patch.1.txt, Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pinaki Poddar updated OPENJPA-1979:
-----------------------------------

    Attachment: Test-1979.zip

The test case uses non-standard join for schema definition.
The domain classes will fail to define database schema

> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>             Fix For: 2.1.0
>
>         Attachments: Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (OPENJPA-1979) Regression for non-standard joins with constant column values

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019067#comment-13019067 ] 

Pinaki Poddar commented on OPENJPA-1979:
----------------------------------------

> XML mapping parser as well. 
Yes, of course.

> lacking a jUnit f
The test case patch has ASF license granted. One can consider including it. The test case does not conform setUp() routine though.

Another couple of points:
a)   There are few more rules to determine whether a specification denotes constant-valued column (ref: MappingInfo.meregColumn(...) and assignment of the local boolean variable named 'constant'). The quick patch does not work out those rules.

b) The downstream effect of changing DBIdentifierType to CONSTANT instead of usual COLUMN not investigated. It was just done to stop the columnName being delimited. 

> Regression for non-standard joins with constant column values 
> --------------------------------------------------------------
>
>                 Key: OPENJPA-1979
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1979
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.0.0-M1, 2.0.0
>            Reporter: Pinaki Poddar
>             Fix For: 2.1.0
>
>         Attachments: OPENJPA-1979.patch.1.txt, Test-1979.zip
>
>
> The non-standard join can use constant column values by enclosing them in single-quote character. This behavior is regressed. The likely cause of this regression is new delimiting support for schema elements introduced in JPA 2.0. The constant column value used to be detected during schema definition based on the assumption of the name being enclosed in single-quote. Due to introduction of delimiting capability, the constant value is now enclosed in double-quote followed by a single-quote.   
> The visible effect is failure to define schema for non-standard join with constant values.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira