Jeff
Jeff

Reputation: 1558

EventListener like AbstractMongoEventListener in Spring Data JPA?

We are migrating from a Spring Data MongoDB repository to a Spring Data JPA repository. We were using the AbstractMongoEventListener to capture onBeforeConvert and onAfterLoad events to enhance the data objects before returning them from our Service layer.

I cannot find similar EventListeners in Spring Data JPA. Are there hooks in Spring Data JPA that I can use to do the same thing? It would be great if I can avoid modifying our service layer to make this change from MongoDB to JPA.

Thanks!

Upvotes: 1

Views: 1334

Answers (1)

Jeff
Jeff

Reputation: 1558

The @PrePersist annotation is exactly what I was looking for.

Upvotes: 1

Related Questions