<?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://foojay.io/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://foojay.io/today/author/mainuls18/index.xml" rel="self" type="application/rss+xml"/><item><title>All about Generics: Part 1</title><link>https://foojay.io/today/all-about-generics-part-1/</link><pubDate>Sun, 20 Mar 2022 22:54:03 +0000</pubDate><guid>https://foojay.io/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;&#10;&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://foojay.io/today/playing-practically-with-stream-api/</link><pubDate>Wed, 16 Feb 2022 00:43:54 +0000</pubDate><guid>https://foojay.io/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;&#10;&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://foojay.io/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://foojay.io/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/</guid><description>&lt;figure class="is-resized"&gt;&#10; &lt;img src="https://foojay.io/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/oie_koKWLHXsUxuL.jpg" alt="" width="452" height="226" style="width:452px;height:226px" loading="lazy" class="is-zoomable"&gt;&lt;/figure&gt;&#10;&#10;&lt;h3 id="background"&gt;Background&lt;/h3&gt;&#10;&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;&#10;&lt;p&gt;Therefore we will refactor the code and use &lt;code&gt;FetchType.LAZY&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;Our old code for the entity was below:&#10;&lt;img src="https://foojay.io/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/1_Tr3xvq9hSvqoK3LHNaib6g-445x510.jpg" alt="Domain model with fetch type EAGER" width="445" height="510" loading="lazy" decoding="async"&gt;&lt;/p&gt;&#10;&lt;p&gt;After using FetchType.LAZY our new code will be like below:&#10;&lt;img src="https://foojay.io/today/a-walk-to-lazy-fetching-with-hibernate-and-spring-data-jpa/1_Tr3xvq9hSvqoK3LHNaib6g-1-441x510.png" alt="Domain model with fetch type LAZY" width="441" height="510" loading="lazy" decoding="async"&gt;&lt;/p&gt;</description></item></channel></rss>