fun findEmptyStream(batchSize: Int): Stream<RawRelation> {
em.createQuery("select rr from RawRelation rr where rr.to is null order by rr.id asc")
.setHint(HINT_FETCH_SIZE, batchSize)
.unwrap(javax.persistence.Query::class.java)
.resultList
.stream()
.map { it as RawRelation }
}
It’s a simple JPA query , returning a Stream
of my class.
It is OK with Kotlin 1.3.72 , but failed with 1.4.0 . It shows :
Type mismatch.
Required: Stream<RawRelation>
Found: (Stream<Any!>..Stream<*>?)
I try to assign class type :
em.createQuery("..." , RawRelation::class.java)
But it doesn’t work
How to fix it ?
Thanks.