/*
 * JPA DAO Template
 *
 *
 * Takatuka - Template fuer JPA DAO (Extended = ExtendedPersistenceContext ConversationScope (Group = EntityExtendedDAO.class)
 *
 */

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

import javax.inject.Inject;

import de.ivu.elect.business.dokumente.entity.DokumentVorlage;
import de.ivu.elect.jee.entity.ExtendedDAO;

@javax.enterprise.context.RequestScoped
public class DokumentVorlageExtendedDAO extends AbstractDokumentVorlageDAO implements java.io.Serializable {

  private static final long serialVersionUID = 1L;

  @Inject
  transient ExtendedDAO extendedDAO;

  @Inject
  transient de.ivu.elect.presentation.system.ExtendedDAORequestCache cache;

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

  @Override
  public void flush() {
    extendedDAO.flush();
  }

  public void flushNewTransaction() {
    extendedDAO.flushNewTransaction();
  }

/**
* Name: WahlAndArtOrderByNameNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT o FROM DokumentVorlage o WHERE o.wahl=?1 AND o.dokumentVorlageArt=?2 ORDER BY o.name<br>
* SQL: <br>
*/
@Override
public java.util.List<DokumentVorlage> findByWahlAndArtOrderByName( @javax.annotation.Nonnull de.ivu.elect.business.wahl.entity.Wahl wahl,  @javax.annotation.Nonnull de.ivu.elect.business.dokumente.entity.DokumentVorlageArt art) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("DokumentVorlage.findByWahlAndArtOrderByName" ,  wahl ,  art  );

      if (!cache.contains(key)) {
        if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
          System.out.println("Query: " + getClass().getName() + ".findByWahlAndArtOrderByName(): Miss");
        }

        cache.put(key, super.findByWahlAndArtOrderByName( wahl ,  art  ));
      } else if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
        System.out.println("Query: " + getClass().getName() + ".findByWahlAndArtOrderByName(): Hit");
      }

      return new java.util.ArrayList<>((java.util.List<DokumentVorlage>) cache.lookup(key));
    }

    return super.findByWahlAndArtOrderByName( wahl ,  art  );
}
/**
* Name: WahlOrderByArtAndNameNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT o FROM DokumentVorlage o WHERE o.wahl=?1 ORDER BY o.dokumentVorlageArt, o.name<br>
* SQL: <br>
*/
@Override
public java.util.List<DokumentVorlage> findByWahlOrderByArtAndName( @javax.annotation.Nonnull de.ivu.elect.business.wahl.entity.Wahl wahl) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("DokumentVorlage.findByWahlOrderByArtAndName" ,  wahl  );

      if (!cache.contains(key)) {
        if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
          System.out.println("Query: " + getClass().getName() + ".findByWahlOrderByArtAndName(): Miss");
        }

        cache.put(key, super.findByWahlOrderByArtAndName( wahl  ));
      } else if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
        System.out.println("Query: " + getClass().getName() + ".findByWahlOrderByArtAndName(): Hit");
      }

      return new java.util.ArrayList<>((java.util.List<DokumentVorlage>) cache.lookup(key));
    }

    return super.findByWahlOrderByArtAndName( wahl  );
}
/**
* Name: WahlterminAndArtOrderByNameNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT o FROM DokumentVorlage o WHERE o.wahltermin=?1 AND o.dokumentVorlageArt = ?2 ORDER BY o.name<br>
* SQL: <br>
*/
@Override
public java.util.List<DokumentVorlage> findByWahlterminAndArtOrderByName( @javax.annotation.Nonnull de.ivu.elect.business.wahl.entity.Wahltermin wahltermin,  @javax.annotation.Nonnull de.ivu.elect.business.dokumente.entity.DokumentVorlageArt art) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("DokumentVorlage.findByWahlterminAndArtOrderByName" ,  wahltermin ,  art  );

      if (!cache.contains(key)) {
        if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
          System.out.println("Query: " + getClass().getName() + ".findByWahlterminAndArtOrderByName(): Miss");
        }

        cache.put(key, super.findByWahlterminAndArtOrderByName( wahltermin ,  art  ));
      } else if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
        System.out.println("Query: " + getClass().getName() + ".findByWahlterminAndArtOrderByName(): Hit");
      }

      return new java.util.ArrayList<>((java.util.List<DokumentVorlage>) cache.lookup(key));
    }

    return super.findByWahlterminAndArtOrderByName( wahltermin ,  art  );
}
/**
* Name: WahlterminOrderByArtAndNameNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT o FROM DokumentVorlage o WHERE o.wahltermin=?1 ORDER BY o.dokumentVorlageArt, o.name<br>
* SQL: <br>
*/
@Override
public java.util.List<DokumentVorlage> findByWahlterminOrderByArtAndName( @javax.annotation.Nonnull de.ivu.elect.business.wahl.entity.Wahltermin wahltermin) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("DokumentVorlage.findByWahlterminOrderByArtAndName" ,  wahltermin  );

      if (!cache.contains(key)) {
        if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
          System.out.println("Query: " + getClass().getName() + ".findByWahlterminOrderByArtAndName(): Miss");
        }

        cache.put(key, super.findByWahlterminOrderByArtAndName( wahltermin  ));
      } else if (de.ivu.elect.business.system.control.LogQueries.LOG_QUERIES) {
        System.out.println("Query: " + getClass().getName() + ".findByWahlterminOrderByArtAndName(): Hit");
      }

      return new java.util.ArrayList<>((java.util.List<DokumentVorlage>) cache.lookup(key));
    }

    return super.findByWahlterminOrderByArtAndName( wahltermin  );
}

  @Override
  public void clear() {
    cache.clear();

    super.clear();
  }
}
