@EntityListeners equivalent for @ElementCollection

100 views Asked by At

I've a very simple problem which I would like a simple solution but it seems there isn't a default approach on JPA/Hibernate

I've an BasicEntity which has a Listener to monitor persists and updates

My entity has a

@ElementCollection(fetch = FetchType.EAGER)
   @JsonProperty("images")
   @Column(length = 256)
   private final List<String> images = new ArrayList<>();

Everything works fine, the listener is being called on updates and creation, the problem is whenever I alter the images, the entity listener isn't called

the data is correctly stored in the database, but JPA doesn't invoke the update hooks for the listener.

What is the best way to solve this?

1

There are 1 answers

2
Christian Beikov On

I'd consider this a bug if a @PreUpdate listener is not called when you change just the images list. You should report that on JIRA and attach a reproducing test case.