All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.onetwo.common.db.spi.CrudEntityManager Maven / Gradle / Ivy

package org.onetwo.common.db.spi;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.onetwo.common.db.builder.QueryBuilder;
import org.onetwo.common.utils.Page;

public interface CrudEntityManager {
	
	int batchInsert(Collection entities);
 
	T load(PK id);
	
	T findById(PK id);
	
	Optional findOptionalById(PK id);

	/*****
	 * insert or update
	 * @param entity
	 * @return
	 */
	T save(T entity);

	void update(T entity);
	void dymanicUpdate(T entity);
	void persist(T entity);
	
//	T createNew(T entity);

//	T updateAttributes(T entity);

	T remove(T entity);
	
	void removes(Collection entities);

	T removeById(PK id);
	Collection removeByIds(PK[] id);

	int removeAll();

	List findAll();

	Number countRecord(Map properties);

	Number countRecord(Object... params);

	List findListByProperties(Object... properties);

	List findListByProperties(Map properties);
	
	List findListByProperties(QueryBuilder squery);
	
	List findListByExample(Object example);

	Page findPage(final Page page, Object... properties);

	Page findPage(final Page page, Map properties);
	
	Page findPageByExample(final Page page, Object example);
	
	void findPage(final Page page, QueryBuilder query);

	T findUnique(Object... properties);
	
	T findUnique(Map properties);
	
	T findOne(Object... properties);
	
	BaseEntityManager getBaseEntityManager();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy