Hi!
I’ve asked Primefaces team and the Primefaces Core Developer oriented me: “Try to ask the hibernate validator guys. It seems like it uses getter and the property and those types doesn’t match”.
I have a CRUD and I want to change the inputTexArea:
<p:inputTextarea id=“tags” value="#{myController.selected.tags}" />
To the new Primefaces chips component:
<p:chips id=“tags” value="#{myController.selected.tags}" />
An entity class excerpt:
@Lob
@Size(max = 2147483647)
@Column(name = “tags”)
private String tags;
//GETTER AND SETTER OMITTED
The get method works fine, as the tags are displayed in the field as expected:
public List getTags() {
return Arrays.asList(tags.split(","));
}
The problem occurs when I try to Save in database, as an Exception occurs:
public void setTags(List tags) {
this.tags = String.join(",", tags);
}
//excerpt of the Exception:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.CharSequence at org.hibernate.validator.internal.constraintvalidators.SizeValidatorForCharSequence.isValid(SizeValidatorForCharSequence.java:33) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:281)
Can you guys, please, help me?
Thanks in advance.