Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 94361 invoked from network); 11 Jun 2009 15:29:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Jun 2009 15:29:19 -0000 Received: (qmail 2861 invoked by uid 500); 11 Jun 2009 15:29:30 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 2783 invoked by uid 500); 11 Jun 2009 15:29:30 -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 2691 invoked by uid 99); 11 Jun 2009 15:29:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 15:29:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 15:29:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C7E02234C04C for ; Thu, 11 Jun 2009 08:29:07 -0700 (PDT) Message-ID: <2105768288.1244734147817.JavaMail.jira@brutus> Date: Thu, 11 Jun 2009 08:29:07 -0700 (PDT) From: "Ravi P Palacherla (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-1133) DBDictionary.getPlaceholderValueString returns 0 for boolean which fails in PostgreSQL database. In-Reply-To: <834535605.1244685787329.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ravi P Palacherla updated OPENJPA-1133: --------------------------------------- Description: When DBDictionary.getPlaceholderValueString is called with Types.BIT, it returns "0". PostgreSQL actually requires that a boolean be set. It cannot handle a numeric argument. Fix Description: Overriden DBDictionary.getPlaceholderValueString() inside PostgresDictionary to process Types.BIT correctly. Now, the method returns 'false' value when Types.BIT is passed as Column.type. Test case: The above bug is exposed from Kodo product which internally uses openJPA. When a query is made on a subclass using kodo api. Kodo generates an SQL ( with help of openJPA) that has UNION in it. It generates a SQL similar to the following: SELECT 0 FROM public.classA t0 UNION ALL SELECT t0.guidance FROM public.classB t0 It got 0 from the openJPA DBDictionary.getPlaceholderValueString as the guidance data type is boolean. The above SQL will throw an exception in postgreSQL db saying: ERROR: UNION types integer and boolean cannot be matched. was: When DBDictionary.getPlaceholderValueString is called with Types.BIT, it returns "0". PostgreSQL actually requires that a boolean be set. It cannot handle a numeric argument. Fix Description: Overriden DBDictionary.getPlaceholderValueString() inside PostgresDictionary to process Types.BIT correctly. Now, the method returns 'false' value when Types.BIT is passed as Column.type. Test case: I am unable to provide a test case. The above bug is exposed from Kodo product which internally uses openJPA. When a query is made on a subclass using kodo api. Kodo generates an SQL ( with help of openJPA) that has UNION in it. It generates a SQL similar to the following: SELECT 0 FROM public.classA t0 UNION ALL SELECT t0.guidance FROM public.classB t0 It got 0 from the openJPA DBDictionary.getPlaceholderValueString as the guidance data type is boolean. The above SQL will throw an exception in postgreSQL db saying: ERROR: UNION types integer and boolean cannot be matched. Patch Info: [Patch Available] > DBDictionary.getPlaceholderValueString returns 0 for boolean which fails in PostgreSQL database. > ------------------------------------------------------------------------------------------------ > > Key: OPENJPA-1133 > URL: https://issues.apache.org/jira/browse/OPENJPA-1133 > Project: OpenJPA > Issue Type: Bug > Components: query > Affects Versions: 2.0.0 > Environment: openJPA trunk. > PostgreSQL 8.3 > Reporter: Ravi P Palacherla > Assignee: Ravi P Palacherla > Attachments: OPENJPA-1133_trunk.patch > > > When DBDictionary.getPlaceholderValueString is called with Types.BIT, it returns "0". > PostgreSQL actually requires that a boolean be set. It cannot handle a numeric argument. > Fix Description: > Overriden DBDictionary.getPlaceholderValueString() inside PostgresDictionary to process Types.BIT correctly. > Now, the method returns 'false' value when Types.BIT is passed as Column.type. > Test case: > The above bug is exposed from Kodo product which internally uses openJPA. > When a query is made on a subclass using kodo api. > Kodo generates an SQL ( with help of openJPA) that has UNION in it. > It generates a SQL similar to the following: > SELECT 0 FROM public.classA t0 UNION ALL SELECT t0.guidance FROM public.classB t0 > > It got 0 from the openJPA DBDictionary.getPlaceholderValueString as the guidance data type is boolean. > The above SQL will throw an exception in postgreSQL db saying: > ERROR: UNION types integer and boolean cannot be matched. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.