I work with oracle DB, in my table I have one field string datatype (value: true or false)
I have tried to transform for this field p:selectOneMenu with p:selectBooleanButton by inspired solution from Convert h:selectBooleanCheckbox value between boolean and String,
I have tried this code in my persistence layer or in myBean
@Size(max = 5)
@Column(name = "CHAMP04")
private String champ04;
public boolean isChamp04() {
return "true".equals(champ04);
}
public void setChamp04(boolean champ04) {
this.champ04 = champ04 ? "true" : "false";
}
I get error
javax.validation.ValidationException: HV000028: Unexpected exception during isValid call.
Caused By: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.CharSequence.
this error be came when I go back to the p:dataTable list after save/cancel Dialogs views Edit or Create selected row.
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle.ListTitle_champ04}" />
</f:facet>
<h:outputText value="#{item.champ04}" />
</p:column>
If I change declaration for the field, I get error
private boolean champ04;
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.lang.Boolean
thank you in advance for your help and attention