Hi,

If you could upload a unit test, that would be great.

-Patrick

On Jan 17, 2008 5:31 AM, Adam Hardy <[EMAIL PROTECTED]> wrote:
> 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>
>



-- 
Patrick Linskey
202 669 5907

Reply via email to