Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Custom SQL for relationship

On Sat, Nov 27, 2010 at 2:35 PM, cinhtau <cinhtau@xxxxxxxxx> wrote:
Can you post your Entity definition (source)? In my understanding:
  • Company and Employee @ManyToMany-Relationship = yes/no?
Nope, there is a Relationship entity which makes the relationship between Company and Employee. There is Relationships.status, and Relationship.post attributes (among the others) which defines which Relationship is considered as active (retired or not) and on which post the Employee (CEO, CTO, normal employee etc.) is. From this we can build an order for an Employee, which Company is the most relevant and which is the least -> the most relevant will be the DefaultCompany.
  • Usually you define a JoinTable, if it is @ManyToMany
  • Why don't you store the default Company with @OneToOne as extra attribute, besides design issues?
I could define it as an extra attribute, but the trigger would be far too complicate, instead of issuing query for each getDefaultCompany();
Bálint Kriván wrote:
I have to entites: Employee, Company. An Employee can be employed in many Companies, but there is a special Company which should be interpreted as the default one


View this message in context: Re: Custom SQL for relationship
Sent from the EclipseLink - Users mailing list archive at Nabble.com.

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




--
Üdv,
Kriván Bálint

Back to the top