Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jmnarloch/hstreams

A JDK 8 wrapper on top of Hibernate Query API
https://github.com/jmnarloch/hstreams

Last synced: 4 days ago
JSON representation

A JDK 8 wrapper on top of Hibernate Query API

Awesome Lists containing this project

README

        

# Hibernate Streams

A JDK 8 wrapper on top of Hibernate Query API

[![Build Status](https://travis-ci.org/jmnarloch/hstreams.svg?branch=hstreams-43)](https://travis-ci.org/jmnarloch/hstreams)

## Features

* Retrieval of Optional query results
* Query to stream conversion
* Typed queries

Current compatibility: [Hibernate 4.3.x](https://github.com/jmnarloch/hstreams/tree/hstreams-43) / [Hibernate 5.x](https://github.com/jmnarloch/hstreams/tree/hstreams-5)

See the document that summarizes the introduced [API](api.adoc) changes

## Setup

In order to start and running simply add the artifact to your Maven/Gradle build.

```

com.github.jmnarloch
hstreams43
1.0.2

```

## Example

```
SessionFactory originalFactory = ...;

StreamSessionFactory factory = Streams.wrap(originalFactory);
StreamSession session = factory.getCurrentSession();

long count = session.createQuery("from User")
.stream()
.count();

Optional admin = session.createTypedQuery("from User where id = :id", User.class)
.setParameter("id", 1l)
.stream()
.findFirst();

Optional user = session.getOptional("User", 1l);
```

## Todo

* LocalDate and LocalTime support - will be natively supported through Hibernate 5
* Optional> custom type handler/converter