[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] N-M-Table and Additional Fields
|
So, one solution could be to use explicit the n-m-Table as domain class and
use ManyToOne on both sides to this n-m-Table domain class.
The Person contains a list of Person_has_Job objects, instead of Job
objects. The same on the Job side.
I do not like this solution.
Any (better) solutions?
Joe Mc. wrote:
>
> Hi everybody,
>
> I have following scenario:
> 2 Tables with a n-m-relation. That means, I have a third table for the
> n-m-Relation. In this third table I have additional fields.
> artificial Example:
> Person has a Job and the Job could be done from more tha one Person. But
> the salary is not for every Person and Job the same.
> Tables:
> Person(id, name)
> Job(id, title)
> Person_has_Job(person_id, job_id, salary)
>
> Ok. How is the JPA realisation? ;-)
> I can work with ManyToMany and I can define with JoinTable the n-m-table.
> But how is it possible to set the salary value in a (transient) property
> of Job (Job#salary)
>
> I think the example and the reason are clear. Howevery I do not know the
> best solution with JPA.
> Any Hints?
>
> Thanks in advance!
>
> M.Joe
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/N-M-Table-and-Additional-Fields-tp22522463p22534303.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.