Category: Database, Docker

Join the DZone community and get the full member experience. In short, we can query a database like this: This prints the title of the 15 longest films in the database.

In the examples below, we are using JPAstreamer to query the "Sakila" example database that is available for download directly from Oracle or as a Docker instance.

Here is a complete example of how we can use JPAstreamer to create a query that prints out the length and title of the 15 longest films in the database: This will print: As can be seen, queries are simple, concise, completely type-safe and follow the Java Stream standard API.

The background to JPAStreamer is that we have developed the stream-based ORM-tool Speedment, and we have come across many developers that want to use Java streams but are constrained to use Hibernate in their applications.

Related Articles