On this page:
http://struts.apache.org/2.x/docs/crud-demo-i.html

It proposes this code to set the department of an employee.

<s:select name="employee.department.departmentId"
value="%{employee.department.departmentId}" list="departments"
listKey="departmentId" listValue="name"/>

In the case of an "Update", I think this code will map to a :

getEmployee.getDepartment().setDepartmentId(value)

Than I want to merge with JPA the employee, but of course i get an
exception since Hibernate is trying to merge a Department entity of
which i changed the Id.

Well.. I think that in case of update that proposed code doesn't work very well,
I think we should do something:

getEmployee.setDepartment(departmentService.find(value));

What you think?
Am I wrong?
GF

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to