title: What is best practice for validating an object before passing it to an ORM helper class to persist it
body: <p>Say you have an instance of your DB entity class MyClass.
  You have 3 fields in this entity which are all tagged as "Cannot be null"
  If you create an object of this class and pass it along to be persisted you DB layer will throw an exception when it tries to persist the object if it does NOT have the 3 fields populated.
  What is the best practice in this situation.
  Should the constructor, setter methods in MyClass validate that all fields are correct and if not complain.
  Or do you allow an invalid object to be created and have the DB layer do the complaining?</p>