ISE-ComProg-After-Midterm/screwdriver-3.5.6/box/snippets/java/GenericCrud.java

114 lines
2.5 KiB
Java
Raw Permalink Normal View History

2020-10-29 09:38:56 +00:00
package +zoccolo+.generic;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projections;
import org.springframework.dao.DataAccessException;
public abstract interface GenericCrud<T, ID extends Serializable> {
public abstract void clear()
throws DataAccessException, Exception;
public abstract void delete(T entity)
throws DataAccessException, Exception;
public abstract void deleteById(ID id)
throws DataAccessException, Exception;
public abstract List<T> findAll()
throws HibernateException, Exception;
public abstract List<T> findAll(Order order)
throws HibernateException, Exception;
public abstract List<T> findByCriteria(Criterion... criterion)
throws HibernateException, Exception;
public abstract List<T> findByCriteria(Order order, Criterion... criterion)
throws HibernateException, Exception;
public abstract T findUniqueByCriteria(Criterion... criterion)
throws HibernateException, Exception;
public abstract List<T> findByExample(T exampleInstance,
String[] excludeProperty)
throws HibernateException, Exception;
public abstract T findById(ID id, boolean lock)
throws DataAccessException, Exception;
public abstract void flush()
throws DataAccessException, Exception;
public abstract T makePersistent(T entity)
throws DataAccessException, Exception;
public abstract void makeTransient(T entity)
throws DataAccessException, Exception;
public abstract void save(T entity)
throws DataAccessException, Exception;
public abstract void saveOrUpdate(T entity)
throws DataAccessException, Exception;
public void update(T entity)
throws DataAccessException, Exception;
public void merge(T entity)
throws DataAccessException, Exception;
public String getDialect()
throws HibernateException, Exception;
public List<Object> oneColumnQuery(final String q)
throws HibernateException, Exception;
public List<Object[]> manyColumnQuery(final String q)
throws HibernateException;
public Integer howManyRows(Criterion... criterion)
throws DataAccessException;
public Integer howManyRows()
throws DataAccessException;
public Integer howManyRowsAlias(String p, String alias,
Criterion... criterion)
throws DataAccessException;
/* screwdriver_knife */
}