As of 5.2.13, this should work, provided that hibernate.jpa.compliance.proxy=false (default). The reason it will work with this property setting because Hibernate will not initialize the lazy association when getting it's ID. If hibernate.jpa.compliance.proxy=true, then Hibernate will initialize the associated entities before returning the IDs. Initializing the associations in parallel in separate threads will result in multi-threaded access to the EntityManager, which is not supported. Steve Ebersole, Vladislav Pernin, should the List returned by Query#getResultList be an implementation that overrides Collection#parallelStream to return a sequential stream? |