title: Oval validation framework - Implementation of @javax.validation.constraints.Pattern (dont working)
body: <p>i'm making a validation with Oval. I'm using spring batch to populate(csv to object) an object and validating it with Oval. But i think my @javax.validation.constraints.Pattern is not working, because my console doesn't show an error when i run the program.</p>
  
  <p>Here are my clases:</p>
  
  <p>Client.jaba</p>
  
  <pre><code>package com.mistaiker;
  
  
  
  import net.sf.oval.constraint.Length;
  import net.sf.oval.constraint.MinLength;
  import net.sf.oval.constraint.NotEmpty;
  import net.sf.oval.constraint.NotNegative;
  import net.sf.oval.constraint.NotNull;
  
  
  public class Client {
  
      //Atributos
      @NotNull
      @NotEmpty
      @MinLength(value = 1)
      @Length(max=4)
      @javax.validation.constraints.Pattern(regexp = "[a-zA-Z]")
      private String title;
  
      @NotNull
      @NotEmpty
      @MinLength(value = 1)
      @Length(max=20)
      @javax.validation.constraints.Pattern(regexp = "[a-zA-Z]")
      private String firstName;
  
      @NotNull
      @NotEmpty
      @MinLength(value = 1)
      @Length(max=20)
      @javax.validation.constraints.Pattern(regexp = "^[a-zA-Z]")
      private String surname;
  
      @NotNull
      @NotEmpty
      @NotNegative
      @MinLength(value = 10)
      @Length(max=10)
      @javax.validation.constraints.Pattern(regexp = "[0-9]")
      private long regNum;
  
      @NotNull
      @NotEmpty
      @NotNegative 
      @MinLength(value = 2)
      @Length(max=2)
      @javax.validation.constraints.Pattern(regexp = "[0-9]")
      private int assigment_1;
  
      @NotNull
      @NotEmpty
      @NotNegative
      @MinLength(value = 2)
      @Length(max=2)
      @javax.validation.constraints.Pattern(regexp = "[0-9]")
      private int assigment_2;
  
      @NotNull
      @NotEmpty
      @NotNegative
      @MinLength(value = 2)
      @Length(max=2)
      @javax.validation.constraints.Pattern(regexp = "[0-9]")
      private int assigment_3;
  
      @NotNull
      @NotEmpty
      @MinLength(value = 1)
      @Length(max=30)
      @javax.validation.constraints.Pattern(regexp = "[0-9a-zA-Z]")
      private String address;
  
  
      //metodos
      void showData(){
          System.out.println(title + "\t" + firstName + "\t" + surname + "\t" +
                              regNum + "\t" + assigment_1 + "\t" + assigment_2 + "\t" +
                              assigment_3 +  "\t" + address);
      }
  
      //Getters y setters
      public String getTitle() {
          return title;
      }
      public void setTitle(String title) {
          this.title = title;
      }
      public String getFirstName() {
          return firstName;
      }
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
      public String getSurname() {
          return surname;
      }
      public void setSurname(String surname) {
          this.surname = surname;
      }
      public long getRegNum() {
          return regNum;
      }
      public void setRegNum(long regNum) {
          this.regNum = regNum;
      }
      public int getAssigment_1() {
          return assigment_1;
      }
      public void setAssigment_1(int assigment_1) {
          this.assigment_1 = assigment_1;
      }
      public int getAssigment_2() {
          return assigment_2;
      }
      public void setAssigment_2(int assigment_2) {
          this.assigment_2 = assigment_2;
      }
      public int getAssigment_3() {
          return assigment_3;
      }
      public void setAssigment_3(int assigment_3) {
          this.assigment_3 = assigment_3;
      }
      public String getAddress() {
          return address;
      }
      public void setAddress(String address) {
          this.address = address;
      }
  
  
  
  }
  </code></pre>
  
  <p>ClientFieldSetMapper.java</p>
  
  <pre><code>package com.mistaiker;
  
  import org.springframework.batch.item.file.mapping.FieldSetMapper;
  import org.springframework.batch.item.file.transform.FieldSet;
  import org.springframework.validation.BindException;
  
  public class ClientFieldSetMapper implements FieldSetMapper&lt;Client&gt;{
  
      @Override
      public Client mapFieldSet(FieldSet fieldSet) throws BindException {
  
          Client client = new Client();
  
          client.setTitle(fieldSet.readRawString(0));
          client.setFirstName(fieldSet.readRawString(1));
          client.setSurname(fieldSet.readRawString(2));
          client.setRegNum(fieldSet.readLong(3));
          client.setAssigment_1(fieldSet.readInt(4));
          client.setAssigment_2(fieldSet.readInt(5));
          client.setAssigment_3(fieldSet.readInt(6));
          client.setAddress(fieldSet.readRawString(7));
  
          return client;
      }
  
  }
  </code></pre>
  
  <p>App.java</p>
  
  <pre><code>package com.mistaiker;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import net.sf.oval.ConstraintViolation;
  import net.sf.oval.Validator;
  
  import org.springframework.batch.item.ExecutionContext;
  import org.springframework.batch.item.ParseException;
  import org.springframework.batch.item.UnexpectedInputException;
  import org.springframework.batch.item.file.FlatFileItemReader;
  import org.springframework.batch.item.file.mapping.DefaultLineMapper;
  import org.springframework.batch.item.file.transform.DelimitedLineTokenizer;
  import org.springframework.core.io.FileSystemResource;
  
  public class App {
  
      public static void main(String[] args){
  
          FlatFileItemReader&lt;Client&gt; itemReader = new FlatFileItemReader&lt;Client&gt;();
          itemReader.setResource(new FileSystemResource("C:/Users/juan.m.palazzolo/Desktop/data.csv"));   
  
          DefaultLineMapper&lt;Client&gt; lineMapper = new DefaultLineMapper&lt;Client&gt;();
          lineMapper.setLineTokenizer(new DelimitedLineTokenizer());
          lineMapper.setFieldSetMapper(new ClientFieldSetMapper());
          itemReader.setLineMapper(lineMapper);
          itemReader.open(new ExecutionContext());
  
          Client client = new Client();
          ArrayList&lt;Client&gt; clients = new ArrayList&lt;&gt;();
  
          try {
              client = itemReader.read();
  
              //validation!!
              Validator validator = new Validator();//Validator object
              List&lt;ConstraintViolation&gt; violations = validator.validate(client);
  
  
              if(violations.size()&gt;0)
              {
  //              Log.severe("Object " + client + " is invalid.");
  //              throw new BussinessException(violations);
                  System.out.println("error en validacion");
  
              }
  
  
  
              while(client != null){
  
                  client.showData();
  
                  clients.add(client);
  
                  client = itemReader.read();
  
                  if(client != null){
                  violations = validator.validate(client);}
  
  
                  //validation!!
  
  
                  if(violations.size()&gt;0)
                  {
                      //LOG.severe("Object " + client + " is invalid.");
                      //throw new BussinessException(violations);
                      System.out.println("error en validacion");
                  }
              }
  
          } catch (UnexpectedInputException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (ParseException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          /*for(Client x: clients){
              x.showData();
          }*/
  
      }
  
  
  }
  </code></pre>
  
  <p>this is my csv:</p>
  
  <pre><code>Mr,juan,mik2e,1234567891,75,84,80,Flat 1a\\The Street\\The Town
  Mr,John,Smith,1234567892,68,57,72,Flat 1b\\The Street\\The Town
  Mr,Zack,Watts,1234567893,32,43,49,Flat 1c\\The Street\\The Town
  Mrs,Hillary,Rix,1234567894,87,88,86,Flat 1d\\The Street\\The Town
  Miss,Zoe,Adams,1234567895,52,48,57,Flat 1e\\The Street\\The Town
  Mr,Andy,Brown,1234567896,42,52,54,Flat 1f\\The Street\\The Town
  </code></pre>