openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Hardy (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-496) columns fill wrong entity fields when names same in joined tables
Date Thu, 28 Feb 2008 12:37:51 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573250#action_12573250
] 

Adam Hardy commented on OPENJPA-496:
------------------------------------

I tried to find a distributable jar for your SingleEMTestCase from OpenJPA but had no joy.

I changed the queries you changed, without any effect on the result. 

I don't really know how to make demonstration of this bug any easier. Admittedly there's a
bit of maven faff around the edges, but if you know maven, you wouldn't notice it.

What snapshot of 1.1.0 are you using? 

I'm using the binaries from http://openjpa.apache.org/builds/1.1.0-SNAPSHOT/downloads/ - I
just ran it with the jar from 21st Feb.

I assume you are using JDK 1.5? And what database software do you use?

For the record, here the JUnit failure:

org.junit.ComparisonFailure: genus title should be: expected:<[genu]s title> but was:<[specie]s
title>
	at org.junit.Assert.assertEquals(Assert.java:92)
	at org.permacode.atomic.FrameworkIntegration1Test.testFindJoin(FrameworkIntegration1Test.java:73)
	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 org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)




> columns fill wrong entity fields when names same in joined tables
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-496
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-496
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Linux 2.6, JDK 1.5.0_12, MySQL 4 or H2
>            Reporter: Adam Hardy
>            Priority: Blocker
>         Attachments: bug.zip, issue496.jar
>
>
> OpenJPA is mixing up the mapping of columns from joined tables, where the two
> tables have fields with the same name used on their respective entities. I've
> got some basic unit tests aimed at verifying the problem. Is there something
> wrong with my mappings or is this a bug? I can upload the unit test project.
> Here's the info. The TITLE fields get mixed up. I have this query:
> select species from Species species
> I have this output:
> SELECT t0.ID, t1.ID, t1.OWNER_ID, t1.TITLE, t0.IUCN_STATUS_ID, t0.OWNER_ID,
> t0.TITLE FROM PUBLIC.SPECIES t0 LEFT OUTER JOIN PUBLIC.GENUS t1 ON t0.GENUS_ID =
> t1.ID
> These are the mappings:
>    <entity class="org.permacode.atomictest.domain.Genus">
>      <table name="GENUS" />
>      <attributes>
>        <id name="id">
>           <column name="ID" />
>           <generated-value strategy="TABLE" generator="genusKeySequence" />
>         </id>
>         <basic name="title">
>           <column name="TITLE" />
>         </basic>
>         <basic name="ownerId">
>           <column name="OWNER_ID" />
>         </basic>
>         <one-to-many name="species" mapped-by="genus">
>           <cascade>
>             <cascade-persist />
>             <cascade-merge />
>             <cascade-refresh />
>           </cascade>
>         </one-to-many>
>       </attributes>
>     </entity>
>     <entity class="org.permacode.atomictest.domain.Species">
>       <table name="SPECIES" />
>       <attributes>
>         <id name="id">
>           <column name="ID" />
>           <generated-value strategy="TABLE" generator="speciesKeySequence" />
>         </id>
>         <basic name="title">
>           <column name="TITLE" />
>         </basic>
>         <basic name="iucnStatus">
>           <column name="IUCN_STATUS_ID" />
>           <enumerated>ORDINAL</enumerated>
>         </basic>
>         <basic name="ownerId">
>           <column name="OWNER_ID" />
>         </basic>
>         <many-to-one name="genus">
>           <join-column name="GENUS_ID" />
>         </many-to-one>
>       </attributes>
>     </entity>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message