You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Maxim Butov (JIRA)" <ji...@apache.org> on 2007/03/28 19:34:25 UTC

[jira] Updated: (OPENJPA-190) org.apache.openjpa.persistence.ArgumentException when using query "SELECT Teacher t, IN(t.courses) c WHERE c = ?"

     [ https://issues.apache.org/jira/browse/OPENJPA-190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maxim Butov updated OPENJPA-190:
--------------------------------

    Environment: JDK 1.5.0_09, Spring 2.0.3, OpenJPA 0.9.6, JpaCriteria 0.6b  (was: JDK 1.5.0_09, Spring 2.0.3, OpenJPA 0.9.6)

> org.apache.openjpa.persistence.ArgumentException when using query "SELECT Teacher t, IN(t.courses) c WHERE c = ?"
> -----------------------------------------------------------------------------------------------------------------
>
>                 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<Integer> {
>     @Id
>     @Column(name = "teacher_id")
>     private Integer id;
>     @Column(name = "name")
>     private String name;
>     @OneToMany(targetEntity = Course.class, mappedBy = "teacher")
>     private Set<Course> courses;
> }
> @Entity(name = "Course")
> @Table(name = "course")
> public class Course extends AbstractEntity<Integer> {
>     @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<Enrolment> 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.