Like spring-data-jpa have @NotNull annotation what can be used for this in spring-data-mongodb.?
相关问题
- Spring Data MongoDB - lazy access to some fields
- SpringData JPA hibernate collection for IN keyword
- Spring boot Autowired repository not working with
- How are fields set on an entity by Spring Data Mon
- Spring Boot CrudRepository or JpaRepository - how
相关文章
- Writing CRUDRepository's findBy() method on a
- Two foreign keys as primary key
- case insensitive sort using spring data
- Spring Data (JPA) - using generics in @Query
- Could not create query metamodel for method public
- Collection based multi tenancy in spring data mong
- How to write a select query in Spring Data Jpa tha
- Implement complex search feature using Spring BOOT
javax.validation.constraints.NotNull
itself could be used with spring-data-mongodb. For this you need to have following in place.JSR-303 dependencies added in your pom.xml
Declare appropriate validators and validator event listeners
Add @NotNull annotation in your MongoDB POJO
With this configuration and implementation, if you persist User object with null values, then you will see failure with
javax.validation.ConstraintViolationException