Adrian Pauli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5eda31c...
) *commented* on HHH-16588 (
https://hibernate.atlassian.net/browse/HHH-16588?atlOrigin=eyJpIjoiZDA1OW...
)
Re: getResultStream() together with join fetch delivers wrong results (
https://hibernate.atlassian.net/browse/HHH-16588?atlOrigin=eyJpIjoiZDA1OW...
)
I see this is expected behavior, but I think it is quite dangerous. Many of the user
probably don’t read the manual really carefully when using this method (as we did
neither). They probably just want to get a java-stream, and in the javadoc of the method
(jakarta.persistence.TypeQuery) there seems to be no danger.
Additionally, that occurs is not the fault easy to find as it relays on the sorting of the
data in the DB. When creating unit-test most often with the small amount of data it is not
triggered or the data is added the same order as it is read.
I see multiple possibilities that could help to reduce the risk for this error:
* Fail on executing the query if it is not sorted by entity
* Log a warning if it occurs that a database-row is ignored because the entity was already
created
* Only allow to use the streaming if a certain flag is set, this would force to read the
doc.
(
https://hibernate.atlassian.net/browse/HHH-16588#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16588#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:11e4e77 )