openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "brian yoder (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2503) Numeric non-standard joins with constant column values broken
Date Fri, 16 May 2014 11:14:56 GMT


brian yoder commented on OPENJPA-2503:

Here is a sample of the issue, the constant value 0 is a number, so should not have single
quotes.  This was working in OpenJPA 1.2, but is broken in 2.3.0.

@JoinColumn(name="business_unit_id", referencedColumnName="0")

I would like to propose that ALL constants should be wrapped with bracket - like "{0}" - or
"{'string value'}" so that you can just look for the bracket to see if this is a constant
or not (so it works with string OR number).  I have made this change as shown below and will
try to check in this change if it looks OK.

    private static final char SINGLE_QUOTE = '\'';
    private static final char BRACE 	   = '{';
    protected void setTargetIdentifier(Column col, String refColumnName) {
    	if (refColumnName.charAt(0) == SINGLE_QUOTE) {
    	} else if (refColumnName.charAt(0) == BRACE) {    		
    		String numericValue = refColumnName.substring(1,refColumnName.length()-1);
    		System.out.println("...TESTING..." + numericValue);
    	} else {
    		col.setTargetIdentifier(DBIdentifier.newColumn(refColumnName, delimit()));

> Numeric non-standard joins with constant column values broken
> -------------------------------------------------------------
>                 Key: OPENJPA-2503
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.3.0
>            Reporter: brian yoder
>            Assignee: Pinaki Poddar
> The non-standard join can use a numeric value, rather than a column or string constant.
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. 
> While the string constant (single quote) has been fixed, the numeric constant (would
not have single quote) is still broken.
> The visible effect is failure to define schema for non-standard join with constant NUMERIC

This message was sent by Atlassian JIRA

View raw message