/*
 * JPA DAO Template
 *
 *
 * Takatuka - Template fuer JPA DAO
 *
 */

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

import de.ivu.elect.business.mandant.entity.Mandant;

@javax.enterprise.context.ApplicationScoped // ELECT-7845
public class MandantDAO extends AbstractMandantDAO {

  private static final long serialVersionUID = 1L;

  @javax.inject.Inject
  private transient de.ivu.elect.jee.entity.SimpleDAO simpleDAO;

  @Override
  protected javax.persistence.EntityManager getEntityManager() {
    return simpleDAO.getEntityManager();
  }

  public void persist(Mandant mandant){
    getEntityManager().persist(mandant);
  }

  public void remove(Mandant mandant){
    getEntityManager().remove(mandant);
  }

@javax.inject.Inject
private transient de.ivu.elect.presentation.system.DAOCache daoCache;

                    
        /**
        * Name: AllNoFlush<br>
        * Beschreibung: <br>
        * EJBQL: SELECT o FROM Mandant o<br>
        * SQL: <br>
        */
        @Override
        public java.util.List<Mandant> findByAll() {

        if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES_DAO) {
        de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Mandant.findByAll"  );

        Object cached = daoCache.findInCache(key);

        if (cached==null) {
          return daoCache.cache(key, super.findByAll( ));
        }
        return (java.util.List<Mandant>) cached;
        }
            return super.findByAll( );
            }
                                                    
@Override
public void clear() {
super.clear();
if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES_DAO) {
daoCache.clear();
}

}

@Override
public void flush() {
super.flush();
if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES_DAO) {
daoCache.clear();
}
}



}