Hi Group !
I have a weird problem with bean validation in JSF and hope someone can help
me.
I have a JEE6 project using JPA2, JSF2, MyFaces CODI 1.0 and MyFaces Extval
2.0.5 (bean, core and property module).
I have an entity with a field ->
@Entity
@Table(name="bewerbungen")
public class Bewerbung extends BaseEntityVersioned implements Serializable {
.....
@Lob
@Column(name="Bemerkung")
private String bemerkung;
.....
}
a Form with h:inputTextarea that writes directly to the entity ->
<h:outputLabel for="bemerkung" value="#{msgs.bewerben_bemerkungen}" />
<h:inputTextarea id="bemerkung"
value="#{applyForJobPage.bewerbung.bemerkung}" rows="12" cols="75"
label="#{msgs.bewerben_bemerkungen}" />
and a view bean->
@Named
@ViewAccessScoped
public class ApplyForJobPage extends AbstractProfilePage{
private Bewerbung bewerbung;
... getter and setter ...
}
There are no validations defined but when I copy a text longer than 255
character into the text field I get a validation Error ! (=> Anschreiben:
Überprüfungsfehler: Wert ist größer als der zulässige Maximalwert "255")
I also tried to change the code to:
<h:inputTextarea id="bemerkung"
value="#{applyForJobPage.bewerbung.bemerkung}" rows="12" cols="75"
label="#{msgs.bewerben_bemerkungen}" >
<f:validateLength maximum="512" />
</h:inputTextarea>
and
@Lob
@Size(max=512)
@Column(name="Bemerkung")
private String bemerkung;
Both didn't work. The only thing that works would be to define a string in
the view bean and move this string into the entity later.
I couldn't find any hints in the internet about a default length of 255
characters.
Any ideas ?
best regards
Thomas