Postgresql中的Java 8 JPA Repository Stream逐行

时间:2017-04-06 13:14:41

标签: spring postgresql java-8 spring-data spring-data-jpa

关于MySQL的阅读this定义了必需的某些查询提示(private getRecordRequestUrl = 'http://localhost/Service/api/ReservationRequest/GetRequestById'; getRecordRequest(RequestId: number): Promise<ReservationModel[]> { return this.http.get(this.getRecordRequestUrl(RequestId)) .toPromise() .then(response => response.json().Data as ReservationModel[]) .catch(this.handleError); } 注释),以便让MySQL逐行处理结果集。有谁知道PostgreSQL需要什么(如果有的话)?

以下是MySQL存储库中的参考查询定义:

@QueryHints

1 个答案:

答案 0 :(得分:8)

它的PostgreSQL等价物是:

System.IO.MemoryStream mymemory = new System.IO.MemoryStream();
img.Save(mymemory,Pbox.Image.RawFormat);
Byte[] myarray = mymemory.GetBuffer();

对于{@ 3},当不满足条件@QueryHints(value = @QueryHint(name = HINT_FETCH_SIZE, value = "1") 时,setFetchSize(rows)会抛出SQLException。 MySQL的JDBC驱动程序并不尊重这一点。

虽然在PostgreSQL中你实际上可以设置大于rows >= 0的值,以允许PostgreSQL的JDBC驱动程序进行一些缓存。 1的{​​{3}}似乎是合理的(除非你有非理性的宽行)。您也可以选择此值作为预期行数的一部分。在部署应用程序之前测试一些变体。