发展环境.
OS: windows 8
IDE : Eclipse Luna with JAVA 8
Postgresql : 9.3.4 in OPENBSD 5.5
Run Code Online (Sandbox Code Playgroud)
其他所有JPA查询,如findFirst3ByTextOrderByTextAsc正常工作.但不是在NativeQuery中,特别是在INTERVAL中
知识库
@RepositoryRestResource(collectionResourceRel = "Nodes", path = "Nodes")
public interface NodeRepository extends
JpaRepository<Node, Integer>,
CrudRepository<Node, Integer>,
PagingAndSortingRepository<Node, Integer>,
Repository<Node, Integer>
{
//1st INTERVAL is native keyword in POSTGRESQL
@Query(value = "SELECT n.* from nodes n WHERE n.node_id = 10510 AND n.last_good_ping > CURRENT_DATE - INTERVAL '1 day' ", nativeQuery = true)
List<Node> getLast24HoursByNodeId();
//2nd
@Query(value = "SELECT n.* from nodes n WHERE n.node_id …Run Code Online (Sandbox Code Playgroud)