我正在尝试从Spring Data Rest Call中传输结果并收到错误:
java.lang.IllegalArgumentException: PersistentEntity
不能为空!
当我不尝试传输结果时,调用有效。任何见解都表示赞赏。
这是存储库定义:
/**
*
*/
package com.xxx.beverage.repository.db2;
import java.util.List;
import java.util.stream.Stream;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.transaction.annotation.Transactional;
import com.xxx.xxx.model.db2.Vbrk;
@RepositoryRestResource
public interface VbrkRepository extends PagingAndSortingRepository<Vbrk, String> {
Vbrk findOne(String id);
@RestResource(path="findByKunag")
@Query(value="SELECT * FROM VBRK v WHERE v.KUNAG = :kunag ", nativeQuery=true)
Stream<Vbrk> findByKunagAndStream(@Param("kunag") String kunag);
Page<Vbrk> findAll(Pageable pageable);
}