{"id":172,"date":"2016-02-22T15:21:43","date_gmt":"2016-02-22T14:21:43","guid":{"rendered":"http:\/\/itblog.inginea.eu\/?p=172"},"modified":"2021-11-18T12:52:01","modified_gmt":"2021-11-18T11:52:01","slug":"jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1","status":"publish","type":"post","link":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/","title":{"rendered":"JPQL Enhancements in JPA 2.1 and Java EE 7 &#8211; JOIN ON"},"content":{"rendered":"\n<p class=\"has-text-align-left\">Java EE 7 is around for a few years already, and provides several very useful and long-awaited features, like entity graphs and better support for stored procedures and results mapping. For an overview, have a look at <a href=\"http:\/\/www.thoughts-on-java.org\/jpa-21-overview\/\">Thorben Janssen&#8217;s blog post<\/a>. The query capabilities were also enhanced, with 3 additional keywords. All of them are available in both JPQL and Criteria API:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li style=\"text-align: left;\"><strong>ON<\/strong> keyword to specify conditions for JOINs<\/li><li style=\"text-align: left;\"><strong>FUNCTION<\/strong> to call arbitrary database function<\/li><li style=\"text-align: left;\"><strong>TREAT<\/strong> to downcast entities to their specific type<\/li><\/ul>\n\n\n\n<p>In this post, I&#8217;ll focus on the first of them &#8211; the ON keyword in JOINs.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">JOIN ON<\/h2>\n\n\n\n<p>JOIN expressions in JPA are already a bit different from JOIN in standard SQL. It is possible to use JOIN only when a mapping between entities already exists, and is not always necessary due to lazy loading of related collections using implicit joins. Be careful with JPA JOIN, if you are a beginner to JPA, and <a href=\"https:\/\/docs.oracle.com\/javaee\/7\/tutorial\/persistence-querylanguage005.htm#JEETT00725\">read the documentation carefully<\/a>.<\/p>\n\n\n\n<p>Until JPA 2.1, it was only possible to filter final query results using conditions in WHERE clause. This is sufficient in most cases. But you may run to a limit at the point, when, using LEFT JOIN, you want to limit what is going to be joined from the other entity. With LEFT JOIN, you always get at least one row from the first entity, but sometimes you do not want to join any instances from the other entity, leaving the joined collection empty.<\/p>\n\n\n\n<p>Apart from <a href=\"http:\/\/docs.jboss.org\/hibernate\/orm\/4.2\/manual\/en-US\/html_single\/#queryhql-joins\">WITH keyword in Hibernate<\/a>, there used to be no standard way of doing this in JPA. Since JPA 2.1, it is possible to add condition to joins with <strong>ON <\/strong>keyword, similar to SQL JOIN ON.<\/p>\n\n\n<pre class=\"wp-block-code line-height:18 show-lang:2 lang:tsql decode:true\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> a <span class=\"hljs-keyword\">FROM<\/span> Person p <span class=\"hljs-keyword\">LEFT<\/span> <span class=\"hljs-keyword\">JOIN<\/span> p.addresses a <span class=\"hljs-keyword\">ON<\/span> a.city = p.city<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The above snippet will retrieve only those addresses, which have the same city as the person. The same can be achieved by moving the condition into WHERE, so we need a more complicated example with multiple joins to see the advantage:<\/p>\n\n\n<pre class=\"wp-block-code line-height:18 show-lang:2 lang:tsql decode:true\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> c <span class=\"hljs-keyword\">FROM<\/span> Person p <span class=\"hljs-keyword\">LEFT<\/span> <span class=\"hljs-keyword\">JOIN<\/span> p.addresses a <span class=\"hljs-keyword\">ON<\/span> a.city = p.city <span class=\"hljs-keyword\">LEFT<\/span> <span class=\"hljs-keyword\">JOIN<\/span> a.country c <span class=\"hljs-keyword\">ON<\/span> c.region = <span class=\"hljs-string\">'Europe'<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In the above example, we get only countries, where and address exists and their person has the same city. What is the difference to using WHERE? If we put both conditions from ON clauses into WHERE at the end, we would include all countries related to all address of a person, and not only to addresses with the same city. Clearly, the result could be bigger, when we apply the condition only at the end. The <strong>ON <\/strong>keyword makes possible to filter results after every join, leading to smaller result after each successive join.<\/p>\n\n\n\n<p>However, one limitation still remains even when using JOIN with ON &#8211; entities can still be joined only when they are mapped together as related entities.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">JOIN ON with multiple roots with Eclipselink and Hibernate<\/h3>\n\n\n\n<p>Eclipselink and Hibernate (since 5.1 as explained <a href=\"https:\/\/vladmihalcea.com\/2017\/10\/10\/how-to-join-unrelated-entities-with-jpa-and-hibernate\/\">by Vlad Mihalcea here<\/a>) provides an additional feature to standard ON keyword. It makes possible to <a href=\"http:\/\/wiki.eclipse.org\/EclipseLink\/UserGuide\/JPA\/Basic_JPA_Development\/Querying\/JPQL#ON\">relate unrelated entities in the ON condition<\/a>, making it possible to JOIN an unrelated entity to other entities already in the query. Therefore, it does not require that fields are mapped&nbsp;as related. This is convenient especially&nbsp;if we need the join condition only for a single report and we don&#8217;t want to update our mappings. Also, integration tests, which generate database tables and constraints from the mappings, will not create foreign keys for unmapped relations if you do not want them for some reason (e.g. if there would be constraint violations in the test data).<\/p>\n\n\n\n<p>Here is an example of extended usage of ON in Eclipselink and Hibernate (not included in JPA 2.1 standard). This one joins persons to a person which&nbsp;has the same city:<\/p>\n\n\n<pre class=\"wp-block-code show-lang:2 lang:tsql decode:true\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> p <span class=\"hljs-keyword\">FROM<\/span> Person p <span class=\"hljs-keyword\">LEFT<\/span> <span class=\"hljs-keyword\">JOIN<\/span> Person p2 <span class=\"hljs-keyword\">ON<\/span> p2.city = p.city<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>","protected":false},"excerpt":{"rendered":"<p>Java EE 7 is around for a few years already, and provides several very useful and long-awaited features, like entity graphs and better support for stored procedures and results mapping. For an overview, have a look at Thorben Janssen&#8217;s blog post. The query capabilities were also enhanced, with 3 additional keywords. All of them are [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":556,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[192],"tags":[21,20,98,9,81],"series":[],"class_list":["post-172","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jakarta-ee","tag-eclipselink","tag-hibernate","tag-javaee7","tag-jpa","tag-jpql"],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JPQL Enhancements in JPA 2.1 and Java EE 7 - JOIN ON - .Lost in Coding<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JPQL Enhancements in JPA 2.1 and Java EE 7 - JOIN ON - .Lost in Coding\" \/>\n<meta property=\"og:description\" content=\"Java EE 7 is around for a few years already, and provides several very useful and long-awaited features, like entity graphs and better support for stored procedures and results mapping. For an overview, have a look at Thorben Janssen&#8217;s blog post. The query capabilities were also enhanced, with 3 additional keywords. All of them are [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/\" \/>\n<meta property=\"og:site_name\" content=\".Lost in Coding\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ondrej.mihalyi\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/ondrej.mihalyi\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-22T14:21:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-11-18T11:52:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2016\/02\/java-persistence-api-jpa-step-by-step-4-728.jpg?fit=596%2C447&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"596\" \/>\n\t<meta property=\"og:image:height\" content=\"447\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ondro Mih\u00e1lyi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/OndroMih\" \/>\n<meta name=\"twitter:site\" content=\"@OndroMih\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ondro Mih\u00e1lyi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/\"},\"author\":{\"name\":\"Ondro Mih\u00e1lyi\",\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\"},\"headline\":\"JPQL Enhancements in JPA 2.1 and Java EE 7 &#8211; JOIN ON\",\"datePublished\":\"2016-02-22T14:21:43+00:00\",\"dateModified\":\"2021-11-18T11:52:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/\"},\"wordCount\":613,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\"},\"keywords\":[\"EclipseLink\",\"Hibernate\",\"JavaEE7\",\"JPA\",\"JPQL\"],\"articleSection\":[\"Jakarta EE\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/\",\"url\":\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/\",\"name\":\"JPQL Enhancements in JPA 2.1 and Java EE 7 - JOIN ON - .Lost in Coding\",\"isPartOf\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#website\"},\"datePublished\":\"2016-02-22T14:21:43+00:00\",\"dateModified\":\"2021-11-18T11:52:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ondro.inginea.eu\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JPQL Enhancements in JPA 2.1 and Java EE 7 &#8211; JOIN ON\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ondro.inginea.eu\/#website\",\"url\":\"https:\/\/ondro.inginea.eu\/\",\"name\":\".Lost in Coding\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ondro.inginea.eu\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616\",\"name\":\"Ondro Mih\u00e1lyi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1\",\"contentUrl\":\"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1\",\"width\":300,\"height\":300,\"caption\":\"Ondro Mih\u00e1lyi\"},\"logo\":{\"@id\":\"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/\"},\"description\":\"Ondro is a software developer and consultant specializing in combining standard and proven tools to solve new and challenging problems. He's been developing in Java for over 10 years. He\u2019s worked for clients like Payara, LottoLand, Uniqa and others. He has co-founded OmniFish, where he works as a director and Jakarta EE expert. He\u2019s passionate about helping his clients and the wider Java community with their projects based on Jakarta EE and similar technologies. As an experienced Java developer and instructor, he's helped companies build and educate their development teams and improve their development processes. He's a core member of several opensource projects and Jakarta EE specification projects. He\u2019s a frequent conference speaker, leader of the Czech JUG and a Java Champion. Ondro is a regular conference speaker at international conferences. Since 2016, he's presented at the following conferences: \u2022 FOSDEM, Brussels, Belgium 2023) \u2022 JChampionsConf, Online (year 2023) \u2022 EclipseCon, Germany (year 2022) \u2022 GeeCon, Prague, Czechia (years 2016, 2019, 2022) \u2022 JavaLand, Bruehl, Germany (years 2018, 2021) \u2022 JFokus, Stockholm, Sweden (year 2019) \u2022 Devops Con, Munich, Germany (year 2019) \u2022 Oracle CodeOne, San Francisco, USA (years 2018, 2019) \u2022 Devoxx, Antwerp, Belgium (year 2018) \u2022 JPrime, Sofia, Bulgaria (years 2017, 2018) \u2022 Java2Days, Sofia, Bulgaria (years 2016, 2018) \u2022 EclipseCon, France (year 2018) \u2022 JavaOne, San Francisco, USA (years 2016, 2017) \u2022 Oracle Code, Prague, Czechia (year 2017) \u2022 Devoxx, London, UK (year 2017) \u2022 GeeCon, Krakow, Poland (year 2017) \u2022 W-JAX, Munich, Germany (years 2016, 2017) \u2022 Bed-Con, Berlin, Germany (year 2017) \u2022 Oredev, Malmo, Sweden (year 2017) \u2022 Devoxx, Casablanca, Morocco (year 2017) \u2022 Java Developer Days, Krakow, Poland (year 2016)\",\"sameAs\":[\"https:\/\/www.facebook.com\/ondrej.mihalyi\",\"https:\/\/cz.linkedin.com\/in\/mihalyiondrej\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/OndroMih\"],\"url\":\"https:\/\/ondro.inginea.eu\/index.php\/author\/ondrejm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JPQL Enhancements in JPA 2.1 and Java EE 7 - JOIN ON - .Lost in Coding","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:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/","og_locale":"en_US","og_type":"article","og_title":"JPQL Enhancements in JPA 2.1 and Java EE 7 - JOIN ON - .Lost in Coding","og_description":"Java EE 7 is around for a few years already, and provides several very useful and long-awaited features, like entity graphs and better support for stored procedures and results mapping. For an overview, have a look at Thorben Janssen&#8217;s blog post. The query capabilities were also enhanced, with 3 additional keywords. All of them are [&hellip;]","og_url":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/","og_site_name":".Lost in Coding","article_publisher":"https:\/\/www.facebook.com\/ondrej.mihalyi","article_author":"https:\/\/www.facebook.com\/ondrej.mihalyi","article_published_time":"2016-02-22T14:21:43+00:00","article_modified_time":"2021-11-18T11:52:01+00:00","og_image":[{"width":596,"height":447,"url":"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2016\/02\/java-persistence-api-jpa-step-by-step-4-728.jpg?fit=596%2C447&ssl=1","type":"image\/jpeg"}],"author":"Ondro Mih\u00e1lyi","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/OndroMih","twitter_site":"@OndroMih","twitter_misc":{"Written by":"Ondro Mih\u00e1lyi","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#article","isPartOf":{"@id":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/"},"author":{"name":"Ondro Mih\u00e1lyi","@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616"},"headline":"JPQL Enhancements in JPA 2.1 and Java EE 7 &#8211; JOIN ON","datePublished":"2016-02-22T14:21:43+00:00","dateModified":"2021-11-18T11:52:01+00:00","mainEntityOfPage":{"@id":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/"},"wordCount":613,"commentCount":0,"publisher":{"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616"},"keywords":["EclipseLink","Hibernate","JavaEE7","JPA","JPQL"],"articleSection":["Jakarta EE"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/","url":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/","name":"JPQL Enhancements in JPA 2.1 and Java EE 7 - JOIN ON - .Lost in Coding","isPartOf":{"@id":"https:\/\/ondro.inginea.eu\/#website"},"datePublished":"2016-02-22T14:21:43+00:00","dateModified":"2021-11-18T11:52:01+00:00","breadcrumb":{"@id":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ondro.inginea.eu\/index.php\/jpql-enhancements-in-jpa-2-1-and-java-ee-7-part-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ondro.inginea.eu\/"},{"@type":"ListItem","position":2,"name":"JPQL Enhancements in JPA 2.1 and Java EE 7 &#8211; JOIN ON"}]},{"@type":"WebSite","@id":"https:\/\/ondro.inginea.eu\/#website","url":"https:\/\/ondro.inginea.eu\/","name":".Lost in Coding","description":"","publisher":{"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ondro.inginea.eu\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/07ac1158ec74720744f7146572215616","name":"Ondro Mih\u00e1lyi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/","url":"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1","contentUrl":"https:\/\/i2.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2017\/08\/fotoOMsquare3x300.jpg?fit=300%2C300&ssl=1","width":300,"height":300,"caption":"Ondro Mih\u00e1lyi"},"logo":{"@id":"https:\/\/ondro.inginea.eu\/#\/schema\/person\/image\/"},"description":"Ondro is a software developer and consultant specializing in combining standard and proven tools to solve new and challenging problems. He's been developing in Java for over 10 years. He\u2019s worked for clients like Payara, LottoLand, Uniqa and others. He has co-founded OmniFish, where he works as a director and Jakarta EE expert. He\u2019s passionate about helping his clients and the wider Java community with their projects based on Jakarta EE and similar technologies. As an experienced Java developer and instructor, he's helped companies build and educate their development teams and improve their development processes. He's a core member of several opensource projects and Jakarta EE specification projects. He\u2019s a frequent conference speaker, leader of the Czech JUG and a Java Champion. Ondro is a regular conference speaker at international conferences. Since 2016, he's presented at the following conferences: \u2022 FOSDEM, Brussels, Belgium 2023) \u2022 JChampionsConf, Online (year 2023) \u2022 EclipseCon, Germany (year 2022) \u2022 GeeCon, Prague, Czechia (years 2016, 2019, 2022) \u2022 JavaLand, Bruehl, Germany (years 2018, 2021) \u2022 JFokus, Stockholm, Sweden (year 2019) \u2022 Devops Con, Munich, Germany (year 2019) \u2022 Oracle CodeOne, San Francisco, USA (years 2018, 2019) \u2022 Devoxx, Antwerp, Belgium (year 2018) \u2022 JPrime, Sofia, Bulgaria (years 2017, 2018) \u2022 Java2Days, Sofia, Bulgaria (years 2016, 2018) \u2022 EclipseCon, France (year 2018) \u2022 JavaOne, San Francisco, USA (years 2016, 2017) \u2022 Oracle Code, Prague, Czechia (year 2017) \u2022 Devoxx, London, UK (year 2017) \u2022 GeeCon, Krakow, Poland (year 2017) \u2022 W-JAX, Munich, Germany (years 2016, 2017) \u2022 Bed-Con, Berlin, Germany (year 2017) \u2022 Oredev, Malmo, Sweden (year 2017) \u2022 Devoxx, Casablanca, Morocco (year 2017) \u2022 Java Developer Days, Krakow, Poland (year 2016)","sameAs":["https:\/\/www.facebook.com\/ondrej.mihalyi","https:\/\/cz.linkedin.com\/in\/mihalyiondrej","https:\/\/twitter.com\/https:\/\/twitter.com\/OndroMih"],"url":"https:\/\/ondro.inginea.eu\/index.php\/author\/ondrejm\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ondro.inginea.eu\/wp-content\/uploads\/2016\/02\/java-persistence-api-jpa-step-by-step-4-728.jpg?fit=596%2C447&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6wlb6-2M","jetpack-related-posts":[{"id":8,"url":"https:\/\/ondro.inginea.eu\/index.php\/deproxy-a-lazily-loaded-jpa-reference-using-standard-java-and-jpa-api\/","url_meta":{"origin":172,"position":0},"title":"Deproxy a lazily loaded JPA reference (using standard Java and JPA API)","author":"Ondro Mih\u00e1lyi","date":"2 July, 2013","format":false,"excerpt":"When tried to tune our near-production application, we came to problem when a single entity reference When tried to tune our near-production application, we came to problem when a single entity reference (not a collection) is loaded lazily. We used inheritance with this entity and hibernate JPA provider (as probably\u2026","rel":"","context":"In &quot;Java&quot;","block_context":{"text":"Java","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/java\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":48,"url":"https:\/\/ondro.inginea.eu\/index.php\/properties-and-config-in-persistence-xml\/","url_meta":{"origin":172,"position":1},"title":"Properties and config in persistence.xml","author":"Ondro Mih\u00e1lyi","date":"12 March, 2013","format":false,"excerpt":"List of elements in persistence.xml","rel":"","context":"In &quot;Configuration&quot;","block_context":{"text":"Configuration","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/config\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":141,"url":"https:\/\/ondro.inginea.eu\/index.php\/differences-in-jpa-entity-locking-modes\/","url_meta":{"origin":172,"position":2},"title":"Differences in JPA entity locking modes","author":"Ondro Mih\u00e1lyi","date":"4 November, 2015","format":false,"excerpt":"JPA provides essentially 2 types of locking mechanisms to help synchronize access to entities. Both mechanisms prevent a scenario, where 2 transactions overwrite data of each other without knowing it. By entity locking, we typically want to prevent following scenario with 2 parallel transactions: Adam's transaction reads data X Barbara's\u2026","rel":"","context":"In &quot;Jakarta EE&quot;","block_context":{"text":"Jakarta EE","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/java\/jakarta-ee\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":513,"url":"https:\/\/ondro.inginea.eu\/index.php\/oracle-to-open-javaee-what-to-expect\/","url_meta":{"origin":172,"position":3},"title":"Oracle announced to open JavaEE &#8211; what to expect in the future?","author":"Ondro Mih\u00e1lyi","date":"26 August, 2017","format":false,"excerpt":"Last week, Oracle announced their intentions to open Java EE and transfer it to an open source foundation to continue its development in a more open way. I've been involved in some email discussions (here and here) and in a conference call organized by Oracle and\u00a0I want to summarize what\u2026","rel":"","context":"In &quot;Opinions&quot;","block_context":{"text":"Opinions","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/opinion\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":157,"url":"https:\/\/ondro.inginea.eu\/index.php\/structure-of-modern-java-ee-application-in-slovak-language\/","url_meta":{"origin":172,"position":4},"title":"[Slovak language] \u0160trukt\u00fara modernej Java EE aplik\u00e1cie","author":"Ondro Mih\u00e1lyi","date":"4 October, 2015","format":false,"excerpt":"Read in Slovak language: \u0160trukt\u00fara modernej Java EE aplik\u00e1cie (Structure of modern Java EE application). \u00a0","rel":"","context":"In &quot;Slovak&quot;","block_context":{"text":"Slovak","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/slovak\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":286,"url":"https:\/\/ondro.inginea.eu\/index.php\/building-a-new-productive-team-around-java-ee-7\/","url_meta":{"origin":172,"position":5},"title":"Building a new productive team around Java&nbsp;EE&nbsp;7","author":"Ondro Mih\u00e1lyi","date":"18 April, 2016","format":false,"excerpt":"Anton Smutn\u00fd is a software engineering manager at Muehlbauer Group, an international industrial company specializing in wide array of technologies. At the technology center located in Nitra, Slovakia, they are building a new agile Java team to fulfil growing internal needs for innovation and automation. Their team approached me to\u2026","rel":"","context":"In &quot;Interviews&quot;","block_context":{"text":"Interviews","link":"https:\/\/ondro.inginea.eu\/index.php\/category\/interviews\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts\/172"}],"collection":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":17,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts\/172\/revisions"}],"predecessor-version":[{"id":964,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/posts\/172\/revisions\/964"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/media\/556"}],"wp:attachment":[{"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/tags?post=172"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ondro.inginea.eu\/index.php\/wp-json\/wp\/v2\/series?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}