Spring MVC and Checkbox
<p>I read many posts, but I didn't find a solution.</p>

<p>I have an object called <strong>Utente</strong>.</p>

<p><strong>Utente</strong> has a field called <strong>autorizzazioniLista</strong></p>

<pre><code>public class Utente{
    ...
    @OneToMany(mappedBy = "utente", fetch = FetchType.EAGER)
    @Cascade(CascadeType.ALL)
    private List&lt;Autorizzazioni&gt; autorizzazioniLista;
    ...
}
</code></pre>

<p><strong>Autorizzazioni</strong> has 3fields: <strong>id</strong>, <strong>utente</strong> and <strong>autorizzazione</strong></p>

<pre><code>public class Autorizzazioni {
    ...
    @Id
    @GeneratedValue
    @Column(name = "id")
    private int id; 

    @ManyToOne(targetEntity = Utente.class, fetch = FetchType.EAGER)    
    private Utente utente;

    @ManyToOne(targetEntity = Autorizzazione.class, fetch = FetchType.EAGER)
    private Autorizzazione autorizzazione;
    ...
}
</code></pre>

<p>and this is <strong>Autorizzazione</strong></p>

<pre><code>public class Autorizzazione{
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="id", nullable=false, updatable=false)
    private int id;     

    @Column(name = "descrizione")
    private String descrizione;
}
</code></pre>

<p>I have a form with <strong>Utente</strong> as modelAttribute. In this form, the objects <strong>Autorizzazioni</strong> of the field <strong>autorizzazioniLista</strong> must be shown as checkbox; here start my problems.</p>

<p>This is the jsp page that shows the checkboxes:</p>

<pre><code>  &lt;form:checkboxes
          items="${utente.autorizzazioniLista}"
          path="autorizzazioniLista"
          itemValue="id" delimiter="&lt;br&gt;&lt;br&gt;"
          itemLabel="autorizzazione.descrizione" /&gt;
</code></pre>

<p>When I submit the form and I retrieve the object Utente inside the controller, the objects  <strong>Autorizzazioni</strong> inside the field <strong>autorizzazioniLista</strong> have their relative fields <strong>Utente</strong> and <strong>Autorizzazione</strong> set to null, so I'm not able to save them on the DB.</p>

<p>The only field of the objects <strong>Autorizzazioni</strong> that is not null is <strong>id</strong>, since inside the tag <code>&lt;form:checkboxes&gt;</code> i set as <code>itemValue</code> the <strong>id</strong> of the objects <strong>Autorizzazioni</strong></p>

<p><strong>NOTE</strong>: of course I use a class that extends <code>PropertyEditorSupport</code>, in order to handle the objects <strong>Autorizzazioni</strong> inside the tag  <code>&lt;form:checkboxes&gt;</code>.</p>

<p>So, my final question is: before the object Utente is retrieved by the controller (the one called after the submit of the form), is there a way to manipulate the the fields of the objects <strong>Autorizzazioni</strong>?</p>

<p>Inside the controller (the one called after the submit of the form) I used <code>@Valid Utente</code>, so the fields of the object Utente must have no errors.</p>