Error codes shoould be 'long'
Added support for custom entity validators