<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Syed Mainul Hasan on foojay.io - Friends of OpenJDK</title><link>https://foojayio.github.io/website/today/author/mainuls18/</link><description>Articles written by Syed Mainul Hasan on foojay.io - Friends of OpenJDK</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sun, 20 Mar 2022 22:54:03 +0000</lastBuildDate><atom:link href="https://foojayio.github.io/website/today/author/mainuls18/index.xml" rel="self" type="application/rss+xml"/><item><title>All about Generics: Part 1</title><link>https://foojayio.github.io/website/today/all-about-generics-part-1/</link><pubDate>Sun, 20 Mar 2022 22:54:03 +0000</pubDate><guid>https://foojayio.github.io/website/today/all-about-generics-part-1/</guid><description>&lt;p&gt;Generics are used to parameterize types. A piece of code can be written generically enough so that we can fit a variety of types in it. Being a strongly type-safe language, Java requires to specify types in all aspects of its code, methods, fields, interfaces, etc.&lt;/p&gt;
&lt;p&gt;However, generics is one of the tricky ways to make it possible to use type parameterization so that one particular portion or entirely of a class or their subclass can support a variety of types if an entity such as class, interface, or method that operates on a parameterized type is said to be a generic entity.&lt;/p&gt;</description></item><item><title>Playing practically with Stream API</title><link>https://foojayio.github.io/website/today/playing-practically-with-stream-api/</link><pubDate>Wed, 16 Feb 2022 00:43:54 +0000</pubDate><guid>https://foojayio.github.io/website/today/playing-practically-with-stream-api/</guid><description>&lt;p&gt;We can find many Stream API examples on Google, but most of them don&amp;rsquo;t represent real life scenarios. Hence, it often remains a black box to understand the power of the Stream API for many rising programmers.&lt;/p&gt;
&lt;p&gt;In this article, I tried to make scenarios based problems where I have tried to make the solution with Stream API. These were initially for my personal practice purposes, and later, I added some more practice problems to demonstrate in my class at Pondit.&lt;/p&gt;</description></item><item><title>A Walk to Lazy Fetching With Hibernate and Spring Data JPA</title><link>https://foojayio.github.io/website/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/</link><pubDate>Wed, 17 Nov 2021 11:47:30 +0000</pubDate><guid>https://foojayio.github.io/website/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/</guid><description>&lt;figure class="wp-block-image is-resized"&gt;
 &lt;img fetchpriority="high" decoding="async" src="oie_koKWLHXsUxuL.jpg" alt="" style="width:452px;height:226px" width="452" height="226"&gt;
&lt;/figure&gt;
&lt;h3 id="h3-0-background"&gt;Background&lt;/h3&gt;
&lt;p&gt;Using &lt;code&gt;FetchType.EAGER&lt;/code&gt; is a very bad practice, since our services may not require all the data of the mapped entities in all cases. And moreover, it is a bad idea to fetch so much data in a single session and makes the session heavy.&lt;/p&gt;
&lt;p&gt;Therefore we will refactor the code and use &lt;code&gt;FetchType.LAZY&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Our old code for the entity was below:
&lt;img src="https://foojayio.github.io/website/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/1_Tr3xvq9hSvqoK3LHNaib6g-445x510.png" alt="Domain model with fetch type EAGER" loading="lazy"&gt;
&lt;/p&gt;
&lt;p&gt;After using FetchType.LAZY our new code will be like below:
&lt;img src="https://foojayio.github.io/website/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/1_Tr3xvq9hSvqoK3LHNaib6g-1-441x510.png" alt="Domain model with fetch type LAZY" loading="lazy"&gt;
&lt;/p&gt;</description></item></channel></rss>