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

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

import de.ivu.elect.business.wahlvorschlag.entity.ReferendumOption;

@javax.enterprise.context.ApplicationScoped // ELECT-7845
public class ReferendumOptionDAO extends AbstractReferendumOptionDAO {

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

  public void remove(ReferendumOption referendumOption){
    getEntityManager().remove(referendumOption);
  }

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

                    
        /**
        * Name: ReferendumVorlageImGebietAndPositionNoFlush<br>
        * Beschreibung: <br>
        * EJBQL: SELECT obj FROM ReferendumOption obj WHERE obj.gruppeImGebiet = ?1 AND obj.position = ?2<br>
        * SQL: <br>
        */
        @Override
        public java.util.List<ReferendumOption> findByReferendumVorlageImGebietAndPosition( @javax.annotation.Nonnull de.ivu.elect.business.gruppeimgebiet.entity.GruppeImGebiet referendumVorlageImGebiet,  @javax.annotation.Nonnull java.lang.Long position) {

        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("ReferendumOption.findByReferendumVorlageImGebietAndPosition" ,  referendumVorlageImGebiet ,  position  );

        Object cached = daoCache.findInCache(key);

        if (cached==null) {
          return daoCache.cache(key, super.findByReferendumVorlageImGebietAndPosition( referendumVorlageImGebiet ,  position  ));
        }
        return (java.util.List<ReferendumOption>) cached;
        }
            return super.findByReferendumVorlageImGebietAndPosition( referendumVorlageImGebiet ,  position  );
            }
                                        
        /**
        * Name: WahlNoFlush<br>
        * Beschreibung: <br>
        * EJBQL: SELECT o FROM ReferendumOption o WHERE o.gruppeImGebiet.gruppe.wahl = ?1<br>
        * SQL: <br>
        */
        @Override
        public java.util.List<ReferendumOption> findByWahl( @javax.annotation.Nonnull de.ivu.elect.business.wahl.entity.Wahl wahl) {

        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("ReferendumOption.findByWahl" ,  wahl  );

        Object cached = daoCache.findInCache(key);

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



}