CheckBoxGroup not selecting values though setValue nor select()

I am trying to use a CheckBoxGroup for selecting a list of Skills for Employees, both of which are db entities. The Skill entities seems to be different instances of the same object, cause they’re picked up from the DB at different times. However, as the entity overrides the equals(Object object) method, they should still be identified as matching, no?

One solution would be to not populate the items with the class itself but some identifier, but more interested to solve it the ‘proper’ way if anyone has encountered this.

It should work as long as equals and hashCode are implemented. Can you provide a minimal example where this is not working properly?

Tulio Garcia:
It should work as long as equals and hashCode are implemented. Can you provide a minimal example where this is not working properly?

Thanks for the prompt reply. The HashCode did indeed solve the issue. I was under the impression that the automatic hashCodes would be unaffected of objects being fetched in different sessions - but I was kidding myself in this case :slight_smile: