You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "seenu.atluri" <se...@gmail.com> on 2015/11/17 18:20:41 UTC

Customize generated ORM file for one-to-many relationship

Hi,

We have CMP2 beans on weblogic, when I migrated those to TomEE. It generated
orm file with one-to-many and many-to-one relationships. 

Eg: For Emp and Dept entities, it generated ORM file with below mappings.

In Emp Enity

<many-to-one name="Dept_emps"/>

In Dept Enity

<one-to-many mapped-by="Dept_emps" name="emps">
                <cascade>
                    <cascade-all/>
                </cascade>
</one-to-many>

While starting the server, it is failing with the error "Dept_emps" not
found in Emp table. It is obvious that corresponding column is not in Emp
table, but it has DEPT_ID foreign key.

We usually put this many-to-one relationship in our hand written ORM file as
below.

<many-to-one name="Dept_emps">
    <join-column referenced-column-name="DEPT_ID" name="DEPT_ID"/>
</many-to-one>

Can we customize generated ORM file so that it can produce <join-column>
element?

Please advise how to handle relationships in generated ORM file. Thanks in
advance.

Thanks!
Srinivas Atluri.




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Customize-generated-ORM-file-for-one-to-many-relationship-tp4676821.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Customize generated ORM file for one-to-many relationship

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

Hou can define a cmp persistence unit with the mapping you want - starting
from the dumped generated one is often easier.
Le 18 nov. 2015 04:15, "seenu.atluri" <se...@gmail.com> a écrit :

> Hi Romain,
>
> Could you please answer my query?
>
> Thanks!
> Srinivas
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Customize-generated-ORM-file-for-one-to-many-relationship-tp4676821p4676833.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: Customize generated ORM file for one-to-many relationship

Posted by "seenu.atluri" <se...@gmail.com>.
Hi Romain,

Could you please answer my query?

Thanks!
Srinivas



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Customize-generated-ORM-file-for-one-to-many-relationship-tp4676821p4676833.html
Sent from the TomEE Users mailing list archive at Nabble.com.