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

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

import de.ivu.elect.business.wahl.entity.Wahlart;

@javax.enterprise.context.ApplicationScoped // ELECT-7845
public class WahlartDAO extends AbstractWahlartDAO {

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

  public void remove(Wahlart wahlart){
    getEntityManager().remove(wahlart);
  }

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

                    
        /**
        * Name: AllOrderByNameNoFlush<br>
        * Beschreibung: <br>
        * EJBQL: SELECT o FROM Wahlart o WHERE o.mandant=?1 ORDER BY o.name<br>
        * SQL: <br>
        */
        @Override
        public java.util.List<Wahlart> findByAllOrderByName( @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("Wahlart.findByAllOrderByName" ,  mandant  );

        Object cached = daoCache.findInCache(key);

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



}