My User entity class have several member variables (e.g. String firstName) which are persisted and some transient variables (e.g. transient boolean selected) which are not.
I have used the transient variable to capture a checkbox selection, but invariably the value never gets set and procesed properly until I set another bean value along with it.
i.e. If User has firstName (mapped to a text field) and selected (mapped to a checkbox) If I just selected the value doesn't seem to be set on an update If I had selected the checkbox and the firstName field, the "selected" value is captured properly
Can anyone tell me why this is happening?
@Entity @Table(name = "User")
public class User implements Serializable {
@Id @GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false)
private Integer id;
@Column(name = "first_Name")
private String firstName;
@Transient private boolean selected; // getters and setters
}
<rich:dataTable value="#{users}" var="_user" style="width:auto;">
...
<rich:column>
<f:facet name="header">Select</f:facet>
<h:selectBooleanCheckbox value="#{_user.selected}"/>
</rich:column>
</rich:dataTable>