package fr.openwide.core.jpa.more.business.search.query;

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

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

import fr.openwide.core.jpa.more.business.sort.ISort;
import fr.openwide.core.jpa.more.business.sort.ISort.SortOrder;

public abstract class AbstractSearchQuery<T, S extends ISort<?>> implements ISearchQuery<T, S> /* NOT Serializable */ {
	
	@PersistenceContext
	protected EntityManager entityManager;
	
	protected List<S> defaultSorts;
	protected Map<S, SortOrder> sortMap;
	
	@SafeVarargs
	protected AbstractSearchQuery(S ... defaultSorts) {
		this.defaultSorts = ImmutableList.copyOf(defaultSorts);
	}
	
	// Sort
	@Override
	public ISearchQuery<T, S> sort(Map<S, SortOrder> sortMap) {
		this.sortMap = ImmutableMap.copyOf(sortMap);
		return this;
	}
	
	// May be overridden for performance purposes
	@Override
	@Transactional(readOnly = true)
	public List<T> fullList() {
		return list(0, Long.MAX_VALUE);
	}
}
@@ -187,74 +187,8 @@
 t;%0A%0A
-import org.springframework.transaction.annotation.Transactional;%0A%0A
 impo
@@ -936,164 +936,5 @@
 %0A%09%7D%0A
-%09%0A%09// May be overridden for performance purposes%0A%09@Override%0A%09@Transactional(readOnly = true)%0A%09public List%3CT%3E fullList() %7B%0A%09%09return list(0, Long.MAX_VALUE);%0A%09%7D%0A
 %7D

Remove default implementation of fullList()