Skip to content

Tag: hibernate

Alternative to using deprecated save method in hibernate

I am using the following code to save a person object into the database: I see that the save method is deprecated. What’s the alternative approach that we are supposed to use? Answer save() is deprecated since Hibernate 6.0. The javadoc suggests to use persist() instead. Deprecated. use persist(Object) …

How to reuse validator class in spring boot app?

I am currently writing custom validator for Spring Boot app and its idea is mainly to do some validations depending on other validations. For example, I want one field to be @NotNull if some other field is null, but the idea is to make it more generic, so that this conditional validations can be changed. For …