-
1. Re: How to update @DataModel and its ListDataModel?
bfo81 Aug 1, 2006 7:25 AM (in response to bfo81)EDIT:
person = em.createQuery("from Person");
should be
persons = em.createQuery("from Person");
with an "s", of course ;).
I wish there would be an edit function here ^^. -
2. Re: How to update @DataModel and its ListDataModel?
js8523 Aug 1, 2006 7:49 AM (in response to bfo81)Because the datamodel uses the object.equals() method to check whether the object has changed.
I fell foul of this as well.
Implement a more thorough equals expression, and datamodel should then realise it needs to push the information out to jsf.
Hope this helps,
James -
3. Re: How to update @DataModel and its ListDataModel?
bfo81 Aug 1, 2006 7:57 AM (in response to bfo81)FOUND THE SOLUTION!
DataModelBinder.isDirty(): This method compares the DataModelList's List with the List annotated by @DataModel to determine if the wrapped List has changed.
And how are two lists compared? list1.equals(list2). This happens by first comparing the sizes of both lists and, if they are equal, comparing the elements pairwise by calling their equals() method.
And that's the point: My equals() method implemented in the Person class just compared the class and getId(), but not the contents of the Person. Maybe this is where the @Version annotation could come into play ;).
Maybe this is helpful for someone who runs into the same problem ;). -
4. Re: How to update @DataModel and its ListDataModel?
bfo81 Aug 1, 2006 7:59 AM (in response to bfo81)@js8523: Thanks for your help. I started writing my post before your answer was there.