Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
A translator that receives JPA entity lifecycle events and refires them as CDI events.

Ideally there would be no need for this class: Errai's EntityManager could just fire these qualified CDI events when it's firing the less-usable-from-CDI JPA events.

public class EventTranslator {
  private static EventTranslator INSTANCE;
  private void initInstance() {
     = this;
  // ========= Item ==========
  private @Inject @New Event<ItemnewItemEvent;
  void fireNewItemEvent(Item i) {
  void fireUpdatedItemEvent(Item i) {
  void fireRemovedItemEvent(Item i) {
  public static class ItemLifecycleListener {
    private void onPostPersist(Item i) {
    private void onPostUpdate(Item i) {
    private void onPostRemove(Item i) {
New to GrepCode? Check out our FAQ X