Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 51741 invoked from network); 2 Aug 2008 14:02:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Aug 2008 14:02:35 -0000 Received: (qmail 21284 invoked by uid 500); 2 Aug 2008 14:02:34 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 21261 invoked by uid 500); 2 Aug 2008 14:02:34 -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 21249 invoked by uid 99); 2 Aug 2008 14:02:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Aug 2008 07:02:34 -0700 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; Sat, 02 Aug 2008 14:01:47 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 36320234C18C for ; Sat, 2 Aug 2008 07:01:44 -0700 (PDT) Message-ID: <809131739.1217685704209.JavaMail.jira@brutus> Date: Sat, 2 Aug 2008 07:01:44 -0700 (PDT) From: "Pinaki Poddar (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Resolved: (OPENJPA-497) Incorect handling of temporal parameters in queries In-Reply-To: <18720731.1200643957529.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pinaki Poddar resolved OPENJPA-497. ----------------------------------- Resolution: Fixed Fix Version/s: 1.3.0 > Incorect handling of temporal parameters in queries > --------------------------------------------------- > > Key: OPENJPA-497 > URL: https://issues.apache.org/jira/browse/OPENJPA-497 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 1.0.1 > Environment: Java 1.6 > Glassfish v2 > openjpa-1.0.1-r420667 > Reporter: Mircea Lazar > Assignee: Pinaki Poddar > Priority: Minor > Fix For: 1.3.0 > > Attachments: openjpa-497.patch > > > The entity: > For an entity: > @Entity > class Log{ > protected Timestamp startTime; > } > given the query > SELECT al FROM Log al WHERE al.startTime BETWEEN :start AND :end ORDER BY al.id ASC > If the query is used as: > query.setParameter("start", start, TemporalType.TIMESTAMP); > query.setParameter("end", end, TemporalType.TIMESTAMP); > where start and end are of type java.util.Date, an exception will be thrown: > org.apache.openjpa.persistence.ArgumentException: The parameter > "start" is of type "java.util.Date", but the declaration in the query > is for type "java.sql.Timestamp". > at org.apache.openjpa.persistence.QueryImpl.validateParameter(QueryImpl.java:270) > at org.apache.openjpa.persistence.QueryImpl.validateParameters(QueryImpl.java:257) > OpenJPA appears to ignore the temporal indications in setParameter because QueryImpl is as this: > public OpenJPAQuery setParameter(int position, Date value, > TemporalType type) { > return setParameter(position, value); > } > The Date parameter should be converted to Timestamp inside setParameter method. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.