Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5E53A11498 for ; Fri, 16 May 2014 14:30:39 +0000 (UTC) Received: (qmail 12357 invoked by uid 500); 16 May 2014 11:52:12 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 22288 invoked by uid 500); 16 May 2014 11:43:17 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 48671 invoked by uid 99); 16 May 2014 11:14:56 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 May 2014 11:14:56 +0000 Date: Fri, 16 May 2014 11:14:56 +0000 (UTC) From: "brian yoder (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OPENJPA-2503) Numeric non-standard joins with constant column values broken MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13999568#comment-13999568 ] 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) { col.setTargetIdentifier(DBIdentifier.newConstant(refColumnName)); } else if (refColumnName.charAt(0) == BRACE) { String numericValue = refColumnName.substring(1,refColumnName.length()-1); System.out.println("...TESTING..." + numericValue); col.setTargetIdentifier(DBIdentifier.newConstant(numericValue)); } else { col.setTargetIdentifier(DBIdentifier.newColumn(refColumnName, delimit())); } } > Numeric non-standard joins with constant column values broken > ------------------------------------------------------------- > > Key: OPENJPA-2503 > URL: https://issues.apache.org/jira/browse/OPENJPA-2503 > 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 values. -- This message was sent by Atlassian JIRA (v6.2#6252)