Jakarta Validator and database lookup validation

Discussions

EJB design: Jakarta Validator and database lookup validation

  1. Jakarta Validator and database lookup validation (2 messages)

    I was looking through the Jakarta Validator stuff and looks really useful.

    But from my reading, a missing component of the framework is a way to validate input against database entries (e.g., to check for primary key/foreign key integrity).

    Has anyone done anything to sort of extend the framework -- or at least the syntax of the Validator file -- to handle that kind of lookup validation?

    Thanks
    Scott

    Threaded Messages (2)

  2. whats the point[ Go to top ]

    Whats the point of validating what the db already validates ? I do checking like this but it is expressed at the object level, i.e. i check that domain objects are non-null. For example if Product object has a Company property then I check that Company is non-null.

    Note that this checking is not related to the database. All checking is done at the java object level. Which is how you should validate your objects, i.e. stick to the medium you are in.

    Bruce
  3. Bruce,

    Thanks for your note.

    It would be great if I could rely on the database to enforce relational integrity.

    But I can't. I have a small role in maintaining a large app that my team inherited but whose initial developers never put any relational constraints on the system.

    That said, validation rules for many objects are client specific and so it's not always possible to put all the constraints into the database. In our set up, the model tier is much easier to customize.

    If anyone is aware of anything already out there, please let me know.

    Thanks
    Scott