speedment / jpa-streamer

JPAstreamer is a lightweight library for expressing JPA queries as Java Streams
GNU Lesser General Public License v2.1
345 stars 35 forks source link

Allow JPAStreamer to be configured with a Supplier of EntityManagers #279

Closed julgus closed 1 year ago

julgus commented 2 years ago

JPAStreamer should be compatible with Hibernate + Panache applications.

To facilitate this we should allow JPAStreamer to be configured with a Supplier<EntityManagers> that can be provided by any PanacheEntityBase. E.g.

@ApplicationScoped
public class FilmRepository implements PanacheRepository<Film> {

    private final JPAStreamer jpaStreamer = JPAStreamer.of(this::getEntityManager);

    public Stream<Film> films() {
        return jpaStreamer.stream(Film.class).limit(10); 
    }

}
julgus commented 1 year ago

I separated the original issue into two parts to reflect the fact that this will be a two-stage rocket. See, #283.