|
|
After reading this: showthread.php?t=64862 and this specifically :
....2. The controller converts that app-specific Presentation Tier object into a generic domain object that is recognized by the business service .....
Can I create my Domain objects (say Employee) in my Controller based on formBackingObject or delegate all parameters that the backing objects holds to my Service, and have a service method return my new transient Article instance, that I can save/update etc.
but again, if my Employee class has 10 fields, and 8 are optional (theoretically), I would end up having 8+ builder methods... ; There is also an option to create my Employee with an no-arg constructor and them parametrize it with setters in my controller.... dunno...I'm :confused
and on another thing......
say I have a service method: updateSalary(employee,newSalary) that checks the salary, and if its bigger than say N raises the salary for the supervisor too.
If I execute quot;new Employee(...,N+100)quot; in my controller and save it, my updateSalary would not be used .....(supervisor's salary would stay the same)....and the last thing...Am I allowed to modify my persistent entities in my controllers, or make new ones and update them with service methods ;
(say I got my article instance from the service object, am I allowed to modify it in my controller, or copy all the fields it to my articleBacking object , modify the on my form, post the form back, create new article instance based on my modified articleBacking object (using the same article id) and update it using my service method) |
|