Java example of hibernate validator CDI to inject default Java bean validation classes implementations e.g. javax.validation.ValidatorFactory and javax.validation.Validator with hibernate-validator-cdi dependency. Also learn to inject specialized validator if application has multiple validator implementations like org.hibernate.validator.cdi.HibernateValidator. Please note that if your application runs in an environment which provides this integration out of the box, then you […]
Learn to solve java exception
UnexpectedTypeException while using hibernate validator for java bean validations.
Java example to use hibernate validator to validate Java bean fields. Bean validation API 2 (JSR-380) offers some popular annotations that can be attached to each bean property for the purpose of maintaining data integrity. 1. Maven dependencies Below are required hibernate validator maven dependencies. Bean validation allows expressions inside the error messages. To parse […]
As you know that hibernate does not support lazy initialization for detached objects. Typically, you load an entity using hibernate session and work-through it and then close the session. After closing the session, entity becomes detached entity, so it cannot make further calls to database until again associated with a new session. But loading whole […]
If you are working on Hibernate and HSqlDB, and you are trying to fetch collection of entities, then you may face this error. For single entity you may or may not find this error. Exception will look like this: Solution This error is due to version mismatch of hibernate and hsqldb. Trying updating latest verion […]