templates.repository_template.vm Maven / Gradle / Ivy
package ${packageName};
import java.util.List;
import java.util.stream.Stream;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.QueryHints;
import org.springframework.transaction.annotation.Transactional;
import jakarta.persistence.QueryHint;
#if( ${restResourceEnabled} )
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(path = "${restResourcePath}")
#else
import org.springframework.stereotype.Repository;
@Repository
#end
public interface ${simpleClassName} extends JpaRepository<${entityType}, Long>{
#if( ${restResourceEnabled} )
@RestResource(exported = false)
#end
List findPagedProjectedBy(Class type);
#if( ${restResourceEnabled} )
@RestResource(exported = false)
#end
List findPagedProjectedBy(Pageable pageable, Class type);
@Transactional(readOnly = true)
@QueryHints(value = @QueryHint(name = org.hibernate.jpa.QueryHints.HINT_FETCH_SIZE, value = "${fetchSize}"))
Stream<${entityType}> streamAllBy();
${methods}
}