You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Adam Hardy (JIRA)" <ji...@apache.org> on 2008/10/20 13:03:44 UTC

[jira] Commented: (OPENJPA-496) columns fill wrong entity fields when names same in joined tables

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

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

I pulled down the openjpa source to get SingleEMTestCase which you compiled the issue496 project attachment against, so that I could see what results you are getting regarding this bug. 

With SingleEMTestCase, SingleEMFTestCase and PersistenceTestCase in the project, it compiles. However it doesn't run, but it falls over during setUp with the exception stating that it needs ConnectionDriverName property setting with a JDBC driver class. 

Can you just give a brief overview of how you configured the test with a database? 

I'm afraid it's not obvious (or I need more caffeine....)

I'm using 1.3.0 trunk. 

I'd definitely like to get this bug on the move - it's a major blocker for openjpa on my project and it is frustrating that we can't even get it to manifest itself in front of the openjpa team.

> 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.