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

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

import de.ivu.elect.business.konfiguration.entity.Konfiguration;

@javax.enterprise.context.ApplicationScoped // ELECT-7845
public class KonfigurationDAO extends AbstractKonfigurationDAO {

  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(Konfiguration konfiguration){
    getEntityManager().persist(konfiguration);
  }

  public void remove(Konfiguration konfiguration){
    getEntityManager().remove(konfiguration);
  }

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

                    
        /**
        * Name: AllNoFlush<br>
        * Beschreibung: <br>
        * EJBQL: SELECT k FROM Konfiguration k<br>
        * SQL: <br>
        */
        @Override
        public java.util.List<Konfiguration> 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("Konfiguration.findByAll"  );

        Object cached = daoCache.findInCache(key);

        if (cached==null) {
          return daoCache.cache(key, super.findByAll( ));
        }
        return (java.util.List<Konfiguration>) cached;
        }
            return super.findByAll( );
            }
                                        
        /**
        * Name: MandantNoFlush<br>
        * Beschreibung: <br>
        * EJBQL: SELECT OBJECT(o) FROM Konfiguration o WHERE o.mandant=?1<br>
        * SQL: <br>
        */
        @Override
        public java.util.List<Konfiguration> findByMandant( @javax.annotation.Nonnull de.ivu.elect.business.mandant.entity.Mandant mandant) {

        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("Konfiguration.findByMandant" ,  mandant  );

        Object cached = daoCache.findInCache(key);

        if (cached==null) {
          return daoCache.cache(key, super.findByMandant( mandant  ));
        }
        return (java.util.List<Konfiguration>) cached;
        }
            return super.findByMandant( mandant  );
            }
                                                                                    
@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();
}
}



}