General J2EE: Database validation or J2EE app validation?

  1. Database validation or J2EE app validation? (1 messages)

    This is a design question.
    What do you think should be the criteria to decide if some validation or functionality should be enforced by the J2EE application or the the DB.

    I.e. in a hierarchy of parent-child objects when deactivating a parent I must validate that all children must be inactive, if not display an error. What is the criteria to decide if this functionality should be in my java app or enforced by the DB?

    any comments are appreciated.

    Threaded Messages (1)

  2. well....[ Go to top ]

    Is the DB going to be accessed through anything other than your J2EE app? If so, it has to be in the DB.

    Is there already rules in the DB for doing this validation? If so, why move it?

    You need to decide if you want the "academic" answer which is all business logic in your app server, or the pragmatic answer which is why not use the DB to it's best advantage?

    Putting it in the DB makes you app DB dependant, but do you *really* need to be DB independent?

    BTW; prepare for a semi-religous war :)