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

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

import javax.inject.Inject;

import de.ivu.elect.business.staat.entity.Staat;
import de.ivu.elect.jee.entity.ExtendedDAO;

@javax.enterprise.context.RequestScoped
public class StaatExtendedDAO extends AbstractStaatDAO 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: AllHavingCustomCodeStaatNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj WHERE obj.customCodeStaat IS NOT NULL<br>
* SQL: <br>
*/
@Override
public java.util.List<Staat> findByAllHavingCustomCodeStaat() {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByAllHavingCustomCodeStaat"  );

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

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

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

    return super.findByAllHavingCustomCodeStaat( );
}
/**
* Name: AllHavingCustomCodeStaatsangehoerigkeitNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj WHERE obj.customCodeStaatsangehoerigkeit IS NOT NULL<br>
* SQL: <br>
*/
@Override
public java.util.List<Staat> findByAllHavingCustomCodeStaatsangehoerigkeit() {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByAllHavingCustomCodeStaatsangehoerigkeit"  );

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

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

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

    return super.findByAllHavingCustomCodeStaatsangehoerigkeit( );
}
/**
* Name: AllOrderedByNameStaatNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj ORDER BY obj.nameStaat<br>
* SQL: <br>
*/
@Override
public java.util.List<Staat> findByAllOrderedByNameStaat() {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByAllOrderedByNameStaat"  );

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

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

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

    return super.findByAllOrderedByNameStaat( );
}
/**
* Name: AllOrderedByNameStaatsangehoerigkeitNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj ORDER BY obj.nameStaatsangehoerigkeit<br>
* SQL: <br>
*/
@Override
public java.util.List<Staat> findByAllOrderedByNameStaatsangehoerigkeit() {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByAllOrderedByNameStaatsangehoerigkeit"  );

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

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

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

    return super.findByAllOrderedByNameStaatsangehoerigkeit( );
}
/**
* Name: UniqueCustomCodeStaatNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj WHERE obj.customCodeStaat = ?1<br>
* SQL: <br>
*/
@Override
public Staat findByUniqueCustomCodeStaat( @javax.annotation.Nonnull java.lang.String uniqueCustomCodeStaat) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByUniqueCustomCodeStaat" ,  uniqueCustomCodeStaat  );

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

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

      return (Staat) cache.lookup(key);
    }

    return super.findByUniqueCustomCodeStaat( uniqueCustomCodeStaat  );
}
/**
* Name: UniqueCustomCodeStaatsangehoerigkeitNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj WHERE obj.customCodeStaatsangehoerigkeit = ?1<br>
* SQL: <br>
*/
@Override
public Staat findByUniqueCustomCodeStaatsangehoerigkeit( @javax.annotation.Nonnull java.lang.String uniqueCustomCodeStaatsangehoerigkeit) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByUniqueCustomCodeStaatsangehoerigkeit" ,  uniqueCustomCodeStaatsangehoerigkeit  );

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

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

      return (Staat) cache.lookup(key);
    }

    return super.findByUniqueCustomCodeStaatsangehoerigkeit( uniqueCustomCodeStaatsangehoerigkeit  );
}
/**
* Name: UniqueIso3166Alpha2NoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj WHERE obj.iso3166Alpha2 = ?1<br>
* SQL: <br>
*/
@Override
public Staat findByUniqueIso3166Alpha2( @javax.annotation.Nonnull java.lang.String uniqueIso3166Alpha2) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByUniqueIso3166Alpha2" ,  uniqueIso3166Alpha2  );

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

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

      return (Staat) cache.lookup(key);
    }

    return super.findByUniqueIso3166Alpha2( uniqueIso3166Alpha2  );
}
/**
* Name: UniqueNameStaatNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj WHERE UPPER(obj.nameStaat) LIKE UPPER(?1)<br>
* SQL: <br>
*/
@Override
public Staat findByUniqueNameStaat( @javax.annotation.Nonnull java.lang.String uniqueNameStaat) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByUniqueNameStaat" ,  uniqueNameStaat  );

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

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

      return (Staat) cache.lookup(key);
    }

    return super.findByUniqueNameStaat( uniqueNameStaat  );
}
/**
* Name: UniqueNameStaatsangehoerigkeitNoFlush<br>
* Beschreibung: <br>
* EJBQL: SELECT obj FROM Staat obj WHERE UPPER(obj.nameStaatsangehoerigkeit) LIKE UPPER(?1)<br>
* SQL: <br>
*/
@Override
public Staat findByUniqueNameStaatsangehoerigkeit( @javax.annotation.Nonnull java.lang.String uniqueNameStaatsangehoerigkeit) {

    if (de.ivu.elect.business.system.control.CacheQueries.CACHE_QUERIES) {
      de.ivu.elect.presentation.system.FinderKey key = new de.ivu.elect.presentation.system.FinderKey("Staat.findByUniqueNameStaatsangehoerigkeit" ,  uniqueNameStaatsangehoerigkeit  );

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

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

      return (Staat) cache.lookup(key);
    }

    return super.findByUniqueNameStaatsangehoerigkeit( uniqueNameStaatsangehoerigkeit  );
}

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

    super.clear();
  }
}
