Skip to content

Instantly share code, notes, and snippets.

@ivanursul
Created February 19, 2015 13:38
Show Gist options
  • Select an option

  • Save ivanursul/b58be0c56d8fd46037dd to your computer and use it in GitHub Desktop.

Select an option

Save ivanursul/b58be0c56d8fd46037dd to your computer and use it in GitHub Desktop.
Dao.java
package org.lnu.is.dao.dao;
import org.lnu.is.pagination.MultiplePagedSearch;
import org.lnu.is.pagination.PagedResult;
/**
* Interface, that has all methods, that are needed
* to work with entities.
* @author ivanursul
*
* @param <ENTITY> Entity class.
* @param <KEY> Identifier class.
*/
public interface Dao<ENTITY, KEY> {
/**
* Method for finding Entities by Id.
* @param id identifier.
* @return Entity.
*/
ENTITY getEntityById(KEY id);
/**
* Method for saving entity.
* @param entity entity.
*/
void save(ENTITY entity);
/**
* Method for updating entity.
* @param entity entity.
*/
void update(ENTITY entity);
/**
* Method for deleting entity.
* @param entity entity.
*/
void delete(ENTITY entity);
/**
* Method for getting paged Result.
* @param pagedSearch
* @return paged result.
*/
PagedResult<ENTITY> getEntities(MultiplePagedSearch<ENTITY> pagedSearch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment