1 Reply Latest reply on Jul 31, 2012 11:38 PM by 929328

    Data validation before adding to database

      I am new to Java and we are trying to validate large amount of data before the data can be inserted into the database.
      We want to make sure that the data is in the format that we expect - like types(int, string etc), Length, no of times the data occurs, mandatory fields etc.

      Ideally we would like to create a schema and define the rules there. As and when the data arrives, we would like to validate the data against the schema.
      What is the best way to achieve this in Java. Below is a simple example

      class DataTobeValidated
      private String Name;
      private int SSN;
      private String Address;
      private String Phone no;

      public void InsertDataIntoDatabase()
      // Insert Data Into Database after Validating the Data.
      public void ValidateData()
      // Validate the data using schema.

      I need to implement ValidateData() using minimal efforts (using some form of schema). Validating using Schema may help since I can change the rules in Schema without having to compile the code.