
package de.ivu.elect.business.mandant.control;

import javax.inject.Inject;
import javax.enterprise.event.Event;

import de.ivu.elect.business.mandant.entity.Mandant;
import de.ivu.elect.business.mandant.boundary.MandantDAO;
import de.ivu.elect.business.mandant.boundary.MandantCreateEvent;

// abgeleitete Klasse NICHT mit "@javax.ejb.Stateless" annotieren!
public abstract class AbstractMandantCreate {

  @Inject
  protected MandantDAO dao;

    @Inject
    transient Event<MandantCreateEvent> createEvent;



  


public void save(Mandant entity) {
    dao.persist(entity);
    sendCreateEvent(entity);
  }

  public void sendCreateEvent(Mandant entity) {
        createEvent.fire(new MandantCreateEvent(entity));
  }

}
