This content has been marked as final.
Show 2 replies
-
1. Re: @OneToMany Question
cptnkirk Jul 27, 2006 6:39 PM (in response to holgerprause)This is really an EJB3/JPA question, not a Seam one. You may get better support if you post your question in that forum. It sounds like you want a ManyToMany relation. If Tasks can have many TaskItems and a TaskItem can be associated with more than one Task this is a ManyToMany relation, not a OneToMany.
-
2. Re: @OneToMany Question
holgerprause Jul 27, 2006 7:28 PM (in response to holgerprause)Hello
It sounds like you want a ManyToMany relation. If Tasks can have many TaskItems and a TaskItem can be associated with more than one Task this is a ManyToMany relation, not a OneToMany.
Hmm but the TaskItem dont have any information about the task it owns
(no getTask() method) and its not biderectional.I shoudl learn sth about database design.
Thx for giving me the right hint i changed my code to:@ManyToMany( targetEntity=TaskItem.class, cascade={CascadeType.PERSIST, CascadeType.MERGE} ) @JoinTable( name="task_taskItems", joinColumns = { @JoinColumn( name="task_id", unique = false)}, inverseJoinColumns = @JoinColumn( name="taskItem_id", unique = false) )
and now its working - no complaining anymore about duplicated entry.
Thank u very much, helped me a lot and sorry for posting in wrong forum.
Bye,
Holger