Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 88536 invoked from network); 28 Mar 2007 18:20:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Mar 2007 18:20:48 -0000 Received: (qmail 8147 invoked by uid 500); 28 Mar 2007 18:20:54 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 8108 invoked by uid 500); 28 Mar 2007 18:20:54 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 8077 invoked by uid 99); 28 Mar 2007 18:20:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Mar 2007 11:20:53 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Mar 2007 11:20:45 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2F693714068 for ; Wed, 28 Mar 2007 11:20:25 -0700 (PDT) Message-ID: <23480084.1175106025172.JavaMail.jira@brutus> Date: Wed, 28 Mar 2007 11:20:25 -0700 (PDT) From: "Jacek Laskowski (JIRA)" To: open-jpa-dev@incubator.apache.org Subject: [jira] Commented: (OPENJPA-190) org.apache.openjpa.persistence.ArgumentException when using query "SELECT t FROM Teacher t, IN(t.courses) c WHERE c = ?1" In-Reply-To: <31492500.1175103025125.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-190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12484953 ] Jacek Laskowski commented on OPENJPA-190: ----------------------------------------- I'm not a OpenJPA developer, but since I'm here taking care of the issue I reported, let me add to it. It seems that the missing piece of information might be the parameter itself which is set via Query.setParameter that's not of a valid type. Is it you who set the parameter or does it happen via Spring (I see Spring involved so there might be an issue with the integration). I think the real culprit is the parameter - its type - of Query.setParameter. Also, is there a way to bump up the version of OpenJPA to 0.9.7-SNAPSHOT? > org.apache.openjpa.persistence.ArgumentException when using query "SELECT t FROM Teacher t, IN(t.courses) c WHERE c = ?1" > ------------------------------------------------------------------------------------------------------------------------- > > Key: OPENJPA-190 > URL: https://issues.apache.org/jira/browse/OPENJPA-190 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 0.9.6 > Environment: JDK 1.5.0_09, Spring 2.0.3, OpenJPA 0.9.6, JpaCriteria 0.6b > Reporter: Maxim Butov > > ENTITIES: > @Entity(name = "Teacher") > @Table(name = "teacher") > public class Teacher extends AbstractEntity { > @Id > @Column(name = "teacher_id") > private Integer id; > @Column(name = "name") > private String name; > @OneToMany(targetEntity = Course.class, mappedBy = "teacher") > private Set courses; > } > @Entity(name = "Course") > @Table(name = "course") > public class Course extends AbstractEntity { > @Id > @Column(name = "course_id") > private Integer id; > @Column(name = "code") > private String code; > @Column(name = "description") > private String description; > @ManyToOne > @JoinColumn(name = "teacher_id") > private Teacher teacher; > @OneToMany(targetEntity = Enrolment.class, mappedBy = "course") > private Set enrolments; > } > QUERY: > SELECT t FROM Teacher t, IN(t.courses) c WHERE c = ?1 > LOG: > 20:21:48.265 ERROR AbstractJpaCriteriaTests Pattern query did not execute succesfully > org.springframework.dao.InvalidDataAccessApiUsageException: The parameter "0" is of type "net.sf.jpacriteria.Course", but the declaration in the query is for type "java.util.Set". ; nested exception is <4|false|0.0.0> org.apache.openjpa.persistence.ArgumentException: The parameter "0" is of type "net.sf.jpacriteria.Course", but the declaration in the query is for type "java.util.Set". > Caused by: > <4|false|0.0.0> org.apache.openjpa.persistence.ArgumentException: The parameter "0" is of type "net.sf.jpacriteria.Course", but the declaration in the query is for type "java.util.Set". > at org.apache.openjpa.persistence.QueryImpl.validateParameter(QueryImpl.java:245) > at org.apache.openjpa.persistence.QueryImpl.validateParameters(QueryImpl.java:225) > at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:206) > at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:251) > at org.springframework.orm.jpa.JpaTemplate$9.doInJpa(JpaTemplate.java:313) > at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:191) > at org.springframework.orm.jpa.JpaTemplate.executeFind(JpaTemplate.java:158) > at org.springframework.orm.jpa.JpaTemplate.find(JpaTemplate.java:305) > at net.sf.jpacriteria.AbstractJpaCriteriaTests.assertCorrect(AbstractJpaCriteriaTests.java:189) > at net.sf.jpacriteria.AbstractCriterionTests.testNullPropertyEq(AbstractCriterionTests.java:235) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at junit.framework.TestCase.runTest(TestCase.java:168) > at junit.framework.TestCase.runBare(TestCase.java:134) > at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69) > at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:47) > at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run(AbstractAnnotationAwareTransactionalTests.java:115) > at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:180) > at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed(AbstractAnnotationAwareTransactionalTests.java:153) > at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:111) > at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:159) > at org.springframework.test.jpa.AbstractJpaTests.runBare(AbstractJpaTests.java:239) > at junit.framework.TestResult$1.protect(TestResult.java:110) > at junit.framework.TestResult.runProtected(TestResult.java:128) > at junit.framework.TestResult.run(TestResult.java:113) > at junit.framework.TestCase.run(TestCase.java:124) > at junit.framework.TestSuite.runTest(TestSuite.java:232) > at junit.framework.TestSuite.run(TestSuite.java:227) > at junit.textui.TestRunner.doRun(TestRunner.java:116) > at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:69) > at junit.textui.TestRunner.doRun(TestRunner.java:109) > at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:24) > at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118) > at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.