Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 9078 invoked from network); 18 Oct 2010 21:00:52 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Oct 2010 21:00:52 -0000 Received: (qmail 88830 invoked by uid 500); 18 Oct 2010 21:00:52 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 88727 invoked by uid 500); 18 Oct 2010 21:00:52 -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 88718 invoked by uid 99); 18 Oct 2010 21:00:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 21:00:52 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 21:00:49 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9IL0ROZ013691 for ; Mon, 18 Oct 2010 21:00:28 GMT Message-ID: <13894953.29461287435626982.JavaMail.jira@thor> Date: Mon, 18 Oct 2010 17:00:26 -0400 (EDT) From: "Heath Thomann (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-1793) @EmbeddedId class having only one field java.sql.Data In-Reply-To: <19693321.171851284445052425.JavaMail.jira@thor> 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-1793?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Heath Thomann updated OPENJPA-1793: ----------------------------------- Attachment: OPENJPA-1793-2.0.x.patch OPENJPA-1793-trunk.patch I'm providing a patch, named OPENJPA-1793-trunk.patch, for trunk. Thanks, Heath > @EmbeddedId class having only one field java.sql.Data > ----------------------------------------------------- > > Key: OPENJPA-1793 > URL: https://issues.apache.org/jira/browse/OPENJPA-1793 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Affects Versions: 2.0.1 > Reporter: Hiroyuki Nakamura > Assignee: Heath Thomann > Priority: Minor > Attachments: OPENJPA-1793-2.0.x.patch, OPENJPA-1793-trunk.patch > > > @EmbeddedId class having only one field java.sql.Data > I become the error such as follows. > --------------------- > Exception in thread "main" org.apache.openjpa.persistence.ArgumentException: Failed to execute query "SELECT m FROM Mzeiritsu m WHERE m.key.tekiyoKaishiYmd = (SELECT MAX(m2.key.tekiyoKaishiYmd) FROM Mzeiritsu m2 WHERE m2.key.tekiyoKaishiYmd < '2010-08-01')". Check the query syntax for correctness. See nested exception for details. > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:870) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:792) > at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542) > at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:288) > at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302) > at itso.bank.entities.test.EntityTester.main(EntityTester.java:40) > Caused by: java.lang.ClassCastException: [Ljava.lang.Object; incompatible with java.util.Calendar > at org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetResult.java:431) > at org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:696) > at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.getPrimaryKeyValue(HandlerFieldStrategy.java:315) > at org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:187) > at org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:146) > at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1020) > at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280) > at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2344) > at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:274) > at org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59) > at org.apache.openjpa.lib.rop.EagerResultList.(EagerResultList.java:36) > at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1246) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:861) > ... 5 more > --------------------- > 315th line of HandlerFieldStrategy class > field.getHandler().getResultArgument(field) > The return value of the method is object array. > Therefore an error occurs at a 431th line of ResultSetResult. > --------------------- > [org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy] > .... > public Object getPrimaryKeyValue(Result res, Column[] cols, ForeignKey fk, > JDBCStore store, Joins joins) > throws SQLException { > Column col; > Object val = null; > if (cols.length == 1) { > col = cols[0]; > if (fk != null) > col = fk.getColumn(col); > val = res.getObject(col, field.getHandler(). > getResultArgument(field), joins); > } else if (cols.length > 1) { > Object[] vals = new Object[cols.length]; > Object[] args = (Object[]) field.getHandler(). > getResultArgument(field); > for (int i = 0; i < vals.length; i++) { > col = cols[i]; > if (fk != null) > col = fk.getColumn(col); > vals[i] = res.getObject(col, (args == null) ? null : args[i], > joins); > } > val = vals; > } > return field.getHandler().toObjectValue(field, val); > } > .... > --------------------- > --------------------- > [org.apache.openjpa.jdbc.sql.ResultSetResult] > .... > case JavaSQLTypes.SQL_DATE: > return getDateInternal(obj, (Calendar) arg, joins); > .... > --------------------- -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.