/*
 * 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);
   
    T findById(Class<T> c, ID primaryKey);
    List<T> findAll(Class<T> c);

    T makePersistent(T entity) throws JPADAOException;
    boolean deletePersistent(Class<T> c, T entity);
    boolean updatePersistent(T entity);   
    
    public String getEntityClassName();
    public String getEntityName();
}
