Bandula wrote:
@ManyToMany( targetEntity = Employee.*class*)
*public* List<Employee> getAssignedEmployeeList()
@ManyToMany(targetEntity = Task.*class*)
*public* List<Task> getAsignedTaskList()
This is insufficient to make these two many-to-many relationships share
the same data. It is important that two objects be able to have
multiple many-to-many relationships: This example may be contrived, but
think: "Employee.getTasksSupervised()/Task.getSupervisors()" and
"Employee.getTasksWorkedOn()/Task.getWorkers()".
I don't use annotations but rather xdoclet tags to specify
relationships, so I cannot tell you exactly what you need to change, but
maybe seeing all the additional stuff I need to specify to specify two
ends of a single many-to-many relationship will get you going in the
right direction: (Names changed to protect my client: Foo and Blah are
nouns, and Bletch is a relationship between the two.)
/**
* @return the blah for which this foo is a bletch
* @hibernate.bag table="blah_bletch_map" cascade="none" lazy="true"
order-by="blah_id"
* @hibernate.key column="foo_id"
* @hibernate.many-to-many class="com.xyz.model.Blah" column="blah_id"
*/
public List<Blah> getBletchOfBlahs()
/**
* @return the bletches
* @hibernate.bag table="blah_bletch_map" cascade="none" lazy="true"
inverse="true" order-by="foo_id"
* @hibernate.key column="blah_id"
* @hibernate.many-to-many class="com.xyz.model.Foo" column="foo_id"
*/
public List<Foo> getBletches()
from Task t where t.assignedEmployeeList in ?
I think you want:
"from Task t where ? in elements(t.assignedEmployeeList)"
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]