/*
 * GenericDAO.java
 *
 * Created on 2 de Dezembro de 2006, 03:41
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package com.tecgraf.dao;

import java.util.List;
import java.util.Map;

/**
 *
 * @param <T>
 * @param <ID> 
 * @author ismael
 * Use one interface per persistent entity, with a super interface for common CRUD functionality
 */
public interface IGenericDAOJPA<T extends IEntityDAOJPA<ID>, ID extends Number> {
  // CRUD methods
  List<T> queryPositionalParams( String queryString, final Object... posParams );
  List<T> queryNamedParams( String queryString, final Map<String, Object> namedParams );

  List<T> findAll( Class<T> c );
  T findById( Class<T> c, ID primaryKey );

  T makePersistent( T entity ) throws GenericDAOJPAException;
  T updatePersistent( Class<T> c, T entity ) throws GenericDAOJPAException;
  boolean deletePersistent( Class<T> c, T entity ) throws GenericDAOJPAException;

  public String getEntityClassName();
  public String getEntityName();
}
