BeanFieldGroup & CustomField<ArrayList<T>>

Hello!

I’ve got a problem with my CustomField in connection with a BeanFieldGroup.

My CustomField basically represents the functionality of a CheckBoxGroup. There’s a set (not a java.util.Set) of entities within the database - the table’s name is ‘EmployeeRank’. Each of these ranks can be connected to an Employee, but they also exist without a connection to any employee. The internal value of the field is represented by an ArrayList. This list gets updated using the setInternalValue()-method using clickListeners on each checkbox.

A BeanFieldGroup binds this CheckBoxGroup to the corresponding entity (an employee). Until here, everything works fine.

However, on commit of the BeanFieldGroup, the PropertyDataSource of the CheckBoxGroup does not get updated. So I overrode the commit()-method of the CustomField to
force
an update of the underlying PropertyDataSource. I found out that somewhere within the code of the CustomField the PropertyDataSource is set to read-only. Why does this happen implicitly and where?

So, using the overridden commit()-method, at least the PropertyDataSource get’s updatet to the correct value. But the commit() method of the BeanFieldGroup - sorry for my language - doesn’t seem to give a f*ck. The Set of the employee-entity get’s not updated. Why? Is it because my model does not include a setter for EmployeeRank?

No exceptions are thrown. I’ve used the BeanFieldGroup several times now.

Relevant model code:

public class Employee {

// (...)

private Set<EmployeeRank> positions;

// (...)

public void addToPositions(EmployeeRank e) {

        if(positions == null) {
            positions = new LinkedHashSet<EmployeeRank>();
        }

        if(e != null && !getPositions().contains(e)) {

            positions.add(e);
            e.addToEmployees(this);

        } 
}

public void addToPositions(Collection<EmployeeRank> c) {

        if(c != null) {
            Iterator<EmployeeRank> iterator = c.iterator();

            while(iterator.hasNext()) {

                addToPositions(iterator.next());

            }
        }
    }

// (...)

}