This happened to me when I was already using @Transactional(value=...)
and was using multiple transaction managers.
My forms were sending back data that already had @JsonIgnore
on them, so the data being sent back from forms was incomplete.
Originally I used the anti pattern solution, but found it was incredibly slow. I disabled this by setting it to false.
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=false
The fix was to ensure that any objects that had lazy-loaded data that weren't loading were retrieved from the database first.
Optional<Object> objectDBOpt = objectRepository.findById(object.getId());
if (objectDBOpt.isEmpty()) {
// Throw error
} else {
Object objectFromDB = objectDBOpt.get();
}
In short, if you've tried all of the other answers, just make sure you look back to check you're loading from the database first if you haven't provided all the @JsonIgnore
properties and are using them in your database query.