hi gerhard,

once again you saved my day (or better night in this case :-)) !  thanx a
lot.

Just for my curiosity -> I couldn't find any hint on the internet that a
@Lob will be validated with a length of 255 by default. Do you know if this
is an extval "feature" or if it is defined elsewhere ?

best regards
Thomas


-----Ursprüngliche Nachricht-----
Von: Gerhard Petracek [mailto:gerhard.petra...@gmail.com] 
Gesendet: Donnerstag, 08. September 2011 21:34
An: MyFaces Discussion
Betreff: Re: Bean Validation

hi thomas,

length of @Column should help. e.g. @Column(length = 512)

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2011/9/8 Ing.Thomas Kernstock <t.kernst...@e-technologies.at>

> 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
>
>
>
>

Reply via email to