Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
Hibernat object handling servicebuilder
20 de julio de 2011 21:14


I have a tables called employee, skill and employees_skill

Now all the employees skill are maintained in employees_Skill

Now in ui i have option to select or delect employee skill, is there a way if i just pass the employee skills selected it would update employees_Skill automatically.

The way liferay does is messy, like they pass both selected ids and delected ids and then first add the selected ones and remove the deselected ones, shouldnt this be automatic as underlying persistence layer is on hibernate and we just pass objects currently selected and it adds and removes on its own.
David H Nebinger
RE: Hibernat object handling servicebuilder
21 de julio de 2011 8:05

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 13216

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

Even in the standard Hibernate way, you still have to follow the same process:

1. pull the hibernate object representing employee.
2. scan the set of skills in the employee pojo, removing the ones that were deselected.
3. retrieve and add the skills to the pojo that were added.
4. save the employee pojo so Hibernate will manage the set correctly.

Many-to-many relationships are always messy to deal with, but maintaining them still involves the same sort of activities...

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!