Skip to content
Uragami Taichi edited this page Jul 16, 2022 · 4 revisions

doma-spring-boot have annotation based event handling feature instead of Doma EventListener.

e.g. The following code handles the entity before an insert.

import java.time.LocalDate;

import org.seasar.doma.boot.event.annotation.HandlePreInsert;
import org.springframework.stereotype.Component;

@Component
public class MessageHandler {
    @HandlePreInsert
    public void preInsert(Message message) {
        message.createdAt = LocalDate.now();
    }
}

See the following link to see what annotations are available.

Clone this wiki locally