{"id":106965,"date":"2020-10-01T07:00:00","date_gmt":"2020-10-01T04:00:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=106965"},"modified":"2020-09-29T16:11:40","modified_gmt":"2020-09-29T13:11:40","slug":"extend-hibernate-to-handle-java-stream-queries","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html","title":{"rendered":"Extend Hibernate to Handle Java Stream Queries"},"content":{"rendered":"<p><em>The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched open-source project<\/em><a href=\"https:\/\/www.github.com\/speedment\/jpa-streamer\"><em> JPAstreamer<\/em><\/a><em> allows you to express Hibernate or other JPA database queries using Java Streams. In this article, we will show you how to extend the API of your existing database applications to handle Stream queries in an instant.&nbsp;<\/em><\/p>\n<p>To quickly give you an idea of what JPAstreamer accomplish, we\u2019ll start by showing you an example of a Stream operating on a database table that contains arbitrary users (with attributes including a first and last name):&nbsp;<\/p>\n<div>\n<div id=\"highlighter_522898\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java plain\">jpaStreamer.stream(User.<\/code><code class=\"java keyword\">class<\/code><code class=\"java plain\">)<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">.filter(User$.firstName.startsWith(\u201dA\u201d)&nbsp;&nbsp;&nbsp;&nbsp; .sort(User$.lastName.reversed())&nbsp;&nbsp;&nbsp;&nbsp; .limit(<\/code><code class=\"java value\">10<\/code><code class=\"java plain\">)&nbsp;&nbsp;&nbsp;&nbsp; .forEach(System.out::println);<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>This will print ten users with a first name that starts with the letter A sorted in reversed order based on their last names. Omitting the details (that are covered shortly), this demonstrates how the desired result set is easily described as a pipeline of Stream operators.&nbsp;<\/p>\n<p>On the surface, it may look as if the presented Stream would require every row in the User-table to be materialized in the JVM. Although, the Stream is actually optimized and rendered to JPA queries. Thus, the Stream queries are as performant as alternative approaches i.e. JPQL or Criteria Builder, but with the difference that JPAstreamer constitutes a streamlined and type-safe approach to expressing queries.<\/p>\n<h3 class=\"wp-block-heading\">How JPAstreamer Works<\/h3>\n<p>JPAstreamer plugs into your application with the addition of a single dependency in your Maven\/Gradle build. The specific dependency is described <a href=\"https:\/\/speedment.github.io\/jpa-streamer\/jpa-streamer\/0.1.8\/get-jpa-streamer\/install-maven.html\">here<\/a>.&nbsp;<\/p>\n<p>Like the well-known Java library Lombok, JPAstreamer uses an annotation processor to form a meta-model at compile time. It inspects any classes marked with the standard JPA annotation @Entity and for every entity Foo.class, a corresponding Foo$.class is generated. The generated classes represent entity attributes as Fields that are used to form predicates on the form User$.firstName.startsWith(\u201dA\u201d) that can be interpreted by JPAstreamer\u2019s query optimizer.&nbsp;&nbsp;<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>It is important to note that JPAstreamer does not alter or disturb the existing codebase, but simply extends the API to handle Java Stream queries from this point forward. Further, the meta-model is placed in \u201cgenerated sources\u201d located in the \u201ctarget\u201d folder and doesn\u2019t need to be checked in with the source code nor tested.<\/p>\n<h3 class=\"wp-block-heading\">Let\u2019s Get Streaming&nbsp;<\/h3>\n<p>We\u2019ll now walk you through the easy process of setting up JPAstreamer in your database application. To follow along, your application must use Java 8 (or later) and Hibernate or another JPA provider that is responsible for object persistence (if you wish to use the Stream API without JPA, you are better off using the open-source Stream ORM <a href=\"https:\/\/www.github.com\/speedment\/speedment\">Speedment<\/a>).&nbsp;<\/p>\n<p>As mentioned, installation simply entails adding a dependency (described <a href=\"https:\/\/speedment.github.io\/jpa-streamer\/jpa-streamer\/0.1.7\/get-jpa-streamer\/install-maven.html\">here<\/a>) to your Maven\/Gradle build and rebuilding the application to generate the JPAstreamer meta-model.&nbsp;<\/p>\n<p>Once you\u2019ve completed the simple set-up, you need to obtain an instance of JPAStreamer like so:&nbsp;<\/p>\n<div>\n<div id=\"highlighter_510638\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java plain\">JPAStreamer jpaStreamer = JPAStreamer.of(<\/code><code class=\"java string\">\"db-name\"<\/code><code class=\"java plain\">);<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>You should replace the String \u201ddb-name\u201d with the name of the persistence unit you wish to query. Look it up in your JPA configuration-file (often named persistence.xml) under the tag &lt;persistence-unit&gt;.<\/p>\n<p>The JPAstreamer instance provides access to the method <em>.stream()<\/em> that accepts the name of the <em>Entity<\/em> you wish to Stream. To query the user table, you would simply type:&nbsp;<\/p>\n<div>\n<div id=\"highlighter_828299\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java plain\">jpaStreamer.stream(User.<\/code><code class=\"java keyword\">class<\/code><code class=\"java plain\">);<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>This returns a stream of all the user rows of type <em>Stream&lt;User<\/em>&gt;. With a Stream source at hand, you are free to add any Java Stream operations to form a pipeline through which the data will flow (data flowing is a conceptual image rather than an actual description of how the code executes). For example:&nbsp;<\/p>\n<div>\n<div id=\"highlighter_581969\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<div class=\"line number3 index2 alt2\">3<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java plain\">List&lt;String&gt; users = jpaStreamer.stream(User.<\/code><code class=\"java keyword\">class<\/code><code class=\"java plain\">)<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">.filter(User$.age.greaterThan(<\/code><code class=\"java value\">20<\/code><code class=\"java plain\">))&nbsp;&nbsp;&nbsp;&nbsp; .map(u -&gt; u.getFirstName() + \u201d \u201d + u.getLastName())<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">.collect(Collectors.toList);<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>This Stream collects the name of users who reached the age of 20 in a List. User$ refers to the generated entity that is part of JPAstreamer\u2019s meta-model. This entity is used to form predicates and comparators for operations such as <em>.filter()<\/em> and <em>.sort() <\/em>which are quickly composed leveraging code completion in modern IDEs.&nbsp;<\/p>\n<p>Here is another example that counts all the users who are from Germany and are named \u201cOtto\u201d using a combined predicate:&nbsp;<\/p>\n<div>\n<div id=\"highlighter_190554\" class=\"syntaxhighlighter  java\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td class=\"gutter\">\n<div class=\"line number1 index0 alt2\">1<\/div>\n<div class=\"line number2 index1 alt1\">2<\/div>\n<\/td>\n<td class=\"code\">\n<div class=\"container\">\n<div class=\"line number1 index0 alt2\"><code class=\"java keyword\">long<\/code> <code class=\"java plain\">count = jpaStreamer.stream(User.<\/code><code class=\"java keyword\">class<\/code><code class=\"java plain\">)<\/code><\/div>\n<div class=\"line number2 index1 alt1\"><code class=\"java spaces\">&nbsp;&nbsp;&nbsp;&nbsp;<\/code><code class=\"java plain\">.filter(User$.country.equal(\u201dGermany\u201d).and(User$.firstName.equal(\u201dOtto\u201d))&nbsp;&nbsp;&nbsp;&nbsp; .count();<\/code><\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n<p>In this article, we have shown how you can integrate the open-source library JPAstreamer with Hibernate (or any JPA provider) to compose type-safe and expressive database queries as standard Java Streams.&nbsp;<\/p>\n<h3 class=\"wp-block-heading\">Resources<\/h3>\n<ul class=\"wp-block-list\">\n<li>GitHub: <a href=\"https:\/\/www.github.com\/speedment\/jpa-streamer\">github.com\/speedment\/jpa-streamer<\/a><\/li>\n<li>Homepage: <a href=\"http:\/\/www.jpastreamer.org\">jpastreamer.org<\/a><\/li>\n<li>Documentation: <a href=\"http:\/\/www.speedment.github.io\/jpa-streamer\">github.io\/jpa-streamer<\/a><\/li>\n<li>Gitter Support Chat:<a href=\"https:\/\/gitter.im\/speedment\/jpa-streamer\">gitter.im\/jpa-streamer<\/a><\/li>\n<\/ul>\n<h4 class=\"wp-block-heading\">Authors<\/h4>\n<p>Per Minborg<br \/>Julia Gustafsson<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Per Minborg, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/minborgsjavapot.blogspot.com\/2020\/09\/extend-hibernate-to-handle-java-stream.html\" target=\"_blank\" rel=\"noopener noreferrer\">Extend Hibernate to Handle Java Stream Queries<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched open-source project JPAstreamer allows you to express Hibernate or other JPA database queries using Java Streams. In this article, we will show you how to extend the API of &hellip;<\/p>\n","protected":false},"author":1012,"featured_media":153,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[971],"class_list":["post-106965","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-hibernate"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Extend Hibernate to Handle Java Stream Queries - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extend Hibernate to Handle Java Stream Queries - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-01T04:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Per Minborg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Per Minborg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html\"},\"author\":{\"name\":\"Per Minborg\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/fa1fcf5d879f0a50f8b9dff5f93149a7\"},\"headline\":\"Extend Hibernate to Handle Java Stream Queries\",\"datePublished\":\"2020-10-01T04:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html\"},\"wordCount\":783,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"keywords\":[\"Hibernate\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html\",\"name\":\"Extend Hibernate to Handle Java Stream Queries - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"datePublished\":\"2020-10-01T04:00:00+00:00\",\"description\":\"The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jboss-hibernate-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2020\\\/10\\\/extend-hibernate-to-handle-java-stream-queries.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Extend Hibernate to Handle Java Stream Queries\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/fa1fcf5d879f0a50f8b9dff5f93149a7\",\"name\":\"Per Minborg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g\",\"caption\":\"Per Minborg\"},\"description\":\"I am a guy living in Palo Alto, California, but I am originally from Sweden. I am working as CTO on Speedment with Java and database application acceleration. Check it out on www.speedment.com\",\"sameAs\":[\"http:\\\/\\\/minborgsjavapot.blogspot.co.nz\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/per-minborg\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extend Hibernate to Handle Java Stream Queries - Java Code Geeks","description":"The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html","og_locale":"en_US","og_type":"article","og_title":"Extend Hibernate to Handle Java Stream Queries - Java Code Geeks","og_description":"The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched","og_url":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-10-01T04:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","type":"image\/jpeg"}],"author":"Per Minborg","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Per Minborg","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html"},"author":{"name":"Per Minborg","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/fa1fcf5d879f0a50f8b9dff5f93149a7"},"headline":"Extend Hibernate to Handle Java Stream Queries","datePublished":"2020-10-01T04:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html"},"wordCount":783,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","keywords":["Hibernate"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html","url":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html","name":"Extend Hibernate to Handle Java Stream Queries - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","datePublished":"2020-10-01T04:00:00+00:00","description":"The Java Stream API released in Java 8 has proven itself to be an efficient, terse yet intuitive way of expressing application logic. The newly launched","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jboss-hibernate-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2020\/10\/extend-hibernate-to-handle-java-stream-queries.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Extend Hibernate to Handle Java Stream Queries"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/fa1fcf5d879f0a50f8b9dff5f93149a7","name":"Per Minborg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/15cf6c4f8f7be37438511b5808b5bea6f49c96a70f25b0c2307243826ff1c77a?s=96&d=mm&r=g","caption":"Per Minborg"},"description":"I am a guy living in Palo Alto, California, but I am originally from Sweden. I am working as CTO on Speedment with Java and database application acceleration. Check it out on www.speedment.com","sameAs":["http:\/\/minborgsjavapot.blogspot.co.nz\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/per-minborg"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/106965","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/1012"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=106965"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/106965\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/153"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=106965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=106965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=106965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}