I am not sure if this solution being posted before. But it tooks me 2 months to figure out what's happened. The scenario was: I generate a entity instances list using EntityQuery, put them into a selectItem tag and use convertEntity tag to convert them. If I select some specific items, error msg
value is not valid will pop-up. If I select other items, no problems at all. I tried to override hashCode() and equals(). I even tried to write my own converters but the problem was still there. Then I found that items that did not pass the validation process had something in common: They were lazy-loaded by other entity in the same conversation context. Once I set the loading strategy to EAGER, the problem gone. I guess the cause of the problem is hibernate created a proxy object for the lazy-loaded entity instance. And a real one does not equals to the proxy one. I hope my experience helps, and sorry for my poor english.