Monday, September 30, 2024

What is Factory method Design Pattern in Java with Example - Tutorial

Factory design pattern in Java one of the core design pattern which is used heavily not only in JDK but also in various Open Source framework such as Spring, Struts and Apache along with decorator design pattern in Java. Factory Design pattern is based on Encapsulation object oriented concept. Factory method is used to create different object from factory often refereed as Item and it encapsulate the creation code. So instead of having object creation code on client side we encapsulate inside Factory method in Java. One of the best examples of factory pattern in Java is BorderFactory Class of Swing API.

Top 20 System Design Interview Questions with Answer for 1 to 3 Years Experienced

Hello guys, if you are preparing for FAANG or any Software developer Job Interview on Startup or a Tech company like Spotify, Flipkart, or Zoom but worried about System design questions then you are not alone. System design is an intimidating topic and requires a lot of study and experience to design a real world system. While it's not a rocket science the knowledge of different system design components and concepts are hard to acquire. In the past, I have shared best System Design Courses and best Software architecture courses as both are related to each other and in this article, I am going to share 20 System Design Interview Questions with answers for programmers with zero to 3 years of experience. 

Is The Complete Python Developer in 2024: Zero to Mastery by Andrei Neagoie on ZTM Academy worth it?? [Review]

Hello guys, if you want to learn Python in 2024 and looking to join The Complete Python Developer in 2024:Zero to Mastery course by Andrei Neagoie on Udemy or ZTM Academy but are not sure then you have come to the right place. Earlier, we have shared the best Python 3 Courses to join in 2024 and today's article covers a review of one of the best online courses to learn the python programming language in 2024 for absolute beginners with no prior experience needed to start. This is a comprehensive online Python training course with almost 31 hours of content and also one of the most up-to-date courses to learn Python on Udemy and Zero to Mastery Academy. 

Saturday, September 28, 2024

Builder Design pattern in Java - Example Tutorial

Builder design pattern in Java is a creational pattern i.e. used to create objects, similar to factory method design pattern which is also a creational design pattern. Before learning any design pattern I suggest find out the problem a particular design pattern solves. Its been well-said necessity is a mother of invention. learning design pattern without facing problems is not that effective, Instead, if you have already faced issues then it's much easier to understand design patterns and learn how they solve the issue

Friday, September 27, 2024

Design a Vending Machine in Java - Interview Question

How do you design a Vending Machine in Java? is one of the popular Java interview questions mostly asked at Senior level Java developer Interviews. In a typical coding interview, you will be given a problem statement to develop a vending machine and within a limited time, usually, 2 to 3 hours you need to produce a design document, working code, and unit test in Java. One of the key advantages of such Java interviews is that you can test many essential skills or a candidate in one go. In order to complete the design, coding, and unit testing of a Vending machine, a candidate needs to be really good in all three departments. Recently, I have also seen this question on System Design Interviews, where interviewer want to check experienced developers knowledge on various Software architecture components and design decision. 

How to System Design Trade Position Aggregator? [Solution]

Hello guys, it's been a long since I shared object-oriented design and system design questions in this blog. It was almost 7 to 8 years when I last blogged about how to solve vending machine design problems in Java. Actually, I had ideas for lots of such design questions at that time, but because of the lengthy nature of these kinds of posts and the amount of time they take, they just sit on my list of drafts. I thought to take them out and publish then slowly improve on them instead of publishing the perfect post for the first time, and today, I am excited to share one of such problems, how to design a trade position aggregator in Java. This program is like portfolio management software that monitors your risk and exposure in real-time based on trades. 

Thursday, September 26, 2024

How to Find Duplicate values in a Table? SQL GROUP BY and Having Example| Leetcode Solution

Hello guys, if you are wondering how to find duplicate values in a table then don't worry, there are many ways to find duplicate rows or values from a given table. For example, you can use the GROUP BY and HAVING clause in SQL with count function to find all the rows which has same values for a particular column and then filter out rows where count is just one, I mean unique values. This way you can find all the duplicate from a given table. Using group by you can create groups and if your group has more than 1 element it means it's kind of duplicate.

How to use EXISTS and NOT Exists in SQL? Example Query and Tutorial

Hello Guys, you might have heard about how useful the EXISTS clause is helpful in writing sophisticated queries. Still, at the same time, I have also seen that many programmers struggle to understand and use EXISTS and NOT EXISTS clauses while writing SQL queries.  If you are one of them, then you have come to the right place. Today you will learn how to use the EXISTS clause in SQL by picking up a real-world example and an excellent SQL exercise from the LeetCode. Suppose that a website contains two tables, the Customers table, and the Orders table. Can you write an SQL query to find all customers who have never ordered anything?

Wednesday, September 25, 2024

The 2024 iOS App Developer RoadMap

Hello guys, if you want to become an iOS App developer and looking for a solid roadmap then you are not alone. I was also looking for iOS app developer roadmap when I stumbled upon this awesome looking iOS developer RoadMap on Reddit. This is one of the comprehensive roadmap to take your from zero to master in iOS App Development but its also too much comprehensive and hard to follow. To be honest, I cannot learn all the skills mentioned in this RoadMap unless I spend all of my time on learning them for another 5 to 10 years. So, I created a simplified version of my own iOS developer RoadMap where you only need to learn essential skills to start doing iOS Development and start your career as iOS App developer.

Tuesday, September 24, 2024

Top 10 SQL SELECT Query Examples for Beginners

The Select command in SQL is one of the most powerful and heavily used commands. This is I guess the first command anyone learns in SQL even before CREATE which is used to create a table in SQL. SELECT is used in SQL to fetch records from database tables and you can do a lot many things using Select. For example, you can select all records, you can select few records based on the condition specified in the WHERE clause, select all columns using the wild card (*) or only selecting a few columns by explicitly declaring them in a query.

The 2024 Deep Learning RoadMap (with Resources)

Hello guys, if you want to learn Deep Learning and looking for a complete RoadMap to find out all essential skills, tools, and technologies a professional Deep Learning expert should know then you have come to the right place. Earlier, I have shared The 2024 Python Programmer RoadMapThe 2024 Machine Learning RoadMap and Data Engineering RoadMap and in this article, I am going to share with you The 2024 Deep Learning RoadMap. You can consider the deep learning field as a subset of machine learning that uses neural networks to gain experience from the data instead of the built-in algorithm in machine learning. The application of this field is endless.

The 2024 Blockchain Developer RoadMap (with Resources)

Hello guys, if you want to become a Blockchain Developer in 2024 and looking for guidance then you have come to the right place. Earlier, I have shared best Blockchain courses, books, and best websites to learn Blockchain technology and today, I am going to share how you can become a Blockchain Developer in 2024. Blockchain solutions are one of the most talked-about examples of technological innovation in recent times. Decentralization, transparency, and security in blockchain-based systems and applications can offer new routes for digital transformation. Amidst the growing hype around blockchain technologies, the role of a blockchain developer has become crucial for the emerging ecosystem.

Monday, September 23, 2024

Top 6 Free Data Structure and Algorithm Courses for Java and C Programmers

Data Structure and Algorithm is one of the essential topics for programmers, both to get a job and do well on Job. Good knowledge of data structure and algorithm is the foundation of writing good code. If you are familiar with essential data structures like an array, string, linked list, tree, map, and advanced data structure like Tries, AVL trees, etc and know when to use which data structure and compute the CPU and memory cost of your code in terms  Even though you don't need to write your own array, linked list or hash table, given every major programming SKD provides them like JDK or C++ STL library, you will need to understand them so that you can use them in right place. 

Using the right data structure can drastically improve the performance of an algorithm.

The 2024 Software Architect Roadmap

Hello guys, if you follow me or read my articles then you know that I always in search for good resources and as my experience is growing and many people in my circles are also growing, I always receive a common question, how do I transition from senior developer to Software architect? how long should I be coding? will I ever become a Software architect or solution architect? Some of these questions are born due to no growth and career stuck and some are born due to anxiety but some are also born from people who are looking to grow in their career and that's where the resource like this Software architect RoadMap can help. 

The 2024 Flutter Developer Roadmap

Hello guys, if you want to learn Flutter, one of the popular framework for building cross-platform Mobile applications then you have come to the right place. Earlier, I have shared best Flutter courses and in this article, I am going to share complete Flutter RoadMap. If you know me, I am big fan of RoadMaps and in the past , I have shared Java Developer RoadMap, Python Developer RoadMap, Web Developer RoadMapiOS Developer RoadMap, and  DevOps Engineer RoadMap which you guys have liked it a lot. Now, we will learn about Flutter in depth. Flutter, Google's UI toolkit for building beautiful and natively compiled applications for mobile, web, and desktop, has revolutionized cross-platform app development. 

Sunday, September 22, 2024

The 2024 DevOps Engineer RoadMap [UPDATED]

DevOps is really hot at the moment, and most of my friends, colleagues, and senior developers I know are working hard to become a DevOps engineers and project themselves as DevOps champions in their organization. While I truly understand the benefit of DevOps, which is directly linked to improved software development and deployment, from my limited experience, I can say that it's not an easy job. It's tough to choose the right path in mind of so many tools and practices. Many of my readers also ask me this question is how to become a DevOps engineer, which means should I learn? Which practices should I follow? Does learning Maven and Jenkins is a must for DevOps Engineers?

The 2024 Machine Learning Engineer RoadMap

Hello guys, if you want to become a Machine Learning Engineer in 2024 and looking for Machine Learning RoadMap then you have come to the right place. I love roadmaps and in the past, I have shared Java Developer RoadMap, Python Developer RoadMap, and Machine Learning courses and today, I am going to share with you The 2024 Machine Learning Engineer RoadMap. Machine learning is a good career nowadays since most companies implement them into their services to deliver a better user experience. Data scientists also use them to make predictions for better decision-making and other things. If you want to become a machine learning engineer and feel confused about starting, complete reading this article.

Friday, September 20, 2024

5 Reasons Why Java's old Date and Calendar API was a Bad Design

If you have been programming in Java for a couple of years then you may know that how bad was Java's Date and Calendar API was, I mean the java.util.Date and java.utill.Calendar was badly designed. Though Java has corrected it's a mistake by introducing a brand new, shiny Date and Time API, not many Java developers are using it yet. In a bit to motivate you to use new Date and Time API from Java 8, I am going to list down a couple of reasons why Java's Date and Calendar class has been criticized so much in the past.  These points are also important to know from the Interview point of view because as an experienced Java programmer, it is expected from you to know the shortcomings of the existing API and how new API solves those problems.

The 2024 Laravel Developer RoadMap

Hello folks, if you want to learn Laravel for Web Development but no idea from where to start it then you have come to the right place. Laravel is one of the top PHP Framework for web development and also quite popular one. In the past, I have shared best Laravel Courses and best PHP courses and in this article, I am going to share the full 2024 Laravel RoadMap. I love these roadmap and in the past have shared many of them which you can find at the end of these article. They are often the most comprehensive guide to learn a new technology. 

The 2024 PHP Developer RoadMap

Hello guys, if you want to become a PHP developer in 2024 and looking for guidance like PHP Developer RoadMap, particularly PHP Backend developer roadmap then you have come to the right place. Earlier, I have shared best free PHP courses and MySQL courses for web developers and today, I am going to share how to become a PHP Developer in 2024 and a complete PHP Developer RoadMap which you can follow along. Making web applications can be fun and a promising career since it is insignificant demand and has a respectful salary. Many people are even learning this skill and working as freelancers from home. 

Thursday, September 19, 2024

How to Remove CTRL-M characters From a File in UNIX and Linux? Example

I wanted to transfer some files from Windows to Unix using FileZilla, but the problem arises when these files are transferred (Ascii or Binary mode both) and opened using VI we get ^M characters, also known as CTRL-M characters. I searched about this but the solutions were to remove these ^M characters when files are transferred using utilities. Is there any way that these ^M characters do not appear in the first place? Well, my search continues but I will share the solution which worked for me for removing control M characters i.e. CTRL-M or ^M characters.

10 Example of find command in UNIX and Linux

The find command is one of the most versatile commands in UNIX and Linux, and I used it a lot in my day-to-day work. I believe having a good knowledge of find command in UNIX and understanding of its different options and usage will increase your productivity a lot in UNIX based operating systems, e.g. Redhat Linux or Solaris. If you are a QA, support personnel, and your works involve lots of searching text on Linux machine or if you are a Java or C++ programmer and your code resides in UNIX, find command can significantly help you to look for any word inside your source file in the absence of an IDE.

Wednesday, September 18, 2024

5 Examples to Compare two Dates in Java?

Comparing dates in Java is a common task for Java programmers, now and then we need to compare two dates to check whether two dates are equals, less than, or greater than each other, sometimes we also need to check if one date comes in between two dates. Java provides multiple ways to compare two Dates in Java which is capable of performing Date comparison and letting you know whether two dates are the same, one date comes before or after another date in Java. By the way, when you compare dates, make sure to consider timezones, day light saving time, and precision. 

How to get current Date Timestamps in Java on GMT or Local Timezone? Example Tutorial

Getting current data and timestamps in java is a requirement for most java enterprise applications. The formatting date in java or parsing date in Java is such a common functionality that you will need it now and then. Though most of the programmers look at Google for finding current date and timestamps code in Java, it's worth to have an idea how you can do that by using java.util.Date class. sometimes you might need formatted data string say "yyyy-MM--dd:HH:mm:ss".

Tuesday, September 17, 2024

How to convert java.sql.Date to java.util.Date in Java - JDBC Example

You often need to convert java.sql.Date to java.util.Date while interacting with databases from Java application. Since JDBC the Java API for database connectivity uses java.sql.Date to represent and most of the java code accepts java.util.Date, you have no choice but to convert SQL date to util date in Java. Though, there is some fundamental difference between them e.g. java.sql.Date only contains date part e.g. day, month, and year, it doesn't contain any time attributes, but java.util.Date contains both date and time attributes e.g. hour, minutes, seconds, and milliseconds. So, when you convert a java.sql.Date to java.util.Date, the resultant java.util.Date instance has the time part as zero i.e 00:00:00 to reflect midnight.

JDBC Batch INSERT and UPDATE example in Java with PreparedStatement

JDBC API in Java allows the program to batch insert and update data into the database, which tends to provide better performance by simple virtue of fact that it reduces a lot of database round-trip which eventually improves overall performance. In fact, it’s one of JDBC best practices to insert and update data in batches. For those who don’t know what is batch insert and update, Java provides several ways to execute SQL queries, one of them is JDBC batch insert and update, on which instead of executing SQL query one by one using either Statement or PreparedSatement, you execute a query in batch and send a batch of the query to the database for execution instead of a single query. 

Monday, September 16, 2024

ORA-00904: invalid identifier Error in Oracle 11g database - Solved

If you have worked in the Oracle database ever, you would definitely have seen ORA-00904: invalid identifier error. Doesn't matter which version you are working 10g, 11g or 12g, this is one of the most common error comes while doing CRUD (Create, Read, Update, and Delete) operations in Oracle. By the way, if you are a beginner, SELECT, INSERT, UPDATE and DELETE are used to perform CRUD operations in the Oracle database. What do you do if you get this error while running in SQL script? Like any error, you should first pay attention to error message, what is Oracle trying to say here. Invalid identifier means the column name entered is either missing or invalid, this is one of the most common causes of this error but not the only one.

Difference between LEFT and RIGHT OUTER Joins in SQL - MySQL Join example

There are two kinds of OUTER joins in SQL, LEFT OUTER join and RIGHT OUTER join. The main difference between RIGHT OUTER joins and LEFT OUTER join, as their name suggests, is the inclusion of non-matched rows. Sine INNER join only include matching rows, where the value of the joining column is the same, in the final result set, but OUTER join extends that functionality and also include unmatched rows in the final result. LEFT outer join includes unmatched rows from the table written on the left of the join predicate. 

How to Convert JSON array to String array in Java - GSon example

A JSON array is an ordered collection of values, which are enclosed within brackets e.g. [] and separated by a comma. In this Java tutorial, we will convert JSON Array to String array in Java and subsequently create JSON from Java String Array. This tutorial is similar to our last article in JSON about How to convert JSON object to Java object, instead of a JSON object, here we will convert JSON array to String array or List in Java. As I said earlier, there are lots of open-source libraries out there that can help to parse JSON data format and we have already seen Jackson library in our last example. In this tutorial, we will use GSON to parse the JSON data format and create a Java String array or List from JSON array representation.

How to convert JSON String to Java object - Jackson Example

JSON stands for JavaScript object notation, is a lightweight text or string representation of an object and quickly becoming a popular data exchange format. Though it's pretty early to say that JSON is going to replace XML as a popular data interchange format, It is certainly providing an alternative. JSON represents data in two formats either an object or an array. The JSON object is an unordered collection of keys and values, similar to the String representation of the hash table. On the other hand, JSON Array is an ordered collection of values.

Sunday, September 15, 2024

Coding Interview Cheat Sheet and Resources for Developers

Hello guys, are you looking for job in this tough market? Well, its not easy and market is flooded with a lot of talented people, thanks to what happening in the world. But that should not be an excuse. If you can refer right resources and put in efforts you can still get job, all comes down to how badly you want and how good is your preparation. In the past, I have shared best coding interview books and courses as well as many coding interview questions on String, Array, LinkedList, Binary Tree, Matrix, Recursion, Algorithms, and in general DSA. Today, I am going to share a gist of all these and I will share a coding interview cheat sheet with right resources so that you can get ready for coding interview in minimal amount of time.

Friday, September 13, 2024

How to design a Messaging App like Twitter on System Design Interview?

Hello guys, if you are preparing for system design interview and looking for common System deign problems and resources then you have come to the right place. In the past, I have shared best System Design courses, books, websites, newsletters, cheat sheets, mock interviews, blogs, tips, GitHub repo, and 100+ System Design Interview Questions and Problems and today I am going to discuss one popular System deign problem — designing Twitter or X.com. Designing a complex system like Twitter can be challenging, especially in a system design interview.

Wednesday, September 11, 2024

The 2024 Data Analyst Roadmap

Hello guys, if you are want to become a Data Analyst in 2024 but not sure which skills you need and how to acquire those skills then you have come to the right place. Earlier, I have shared the Java Developer RoadMap, Python Developer RoadMap, Web Developer RoadMapiOS Developer RoadMap, and  DevOps Engineer RoadMap, and in this article, I will share the 2024 Data Analyst RoadMap which will help you to become a Data Analyst in 2024. As we continue to witness unprecedented growth in data generation across industries, the role of a data analyst has become more pivotal than ever. 

Parsing Large JSON Files using Jackson Streaming API Example

In the last couple of JSON tutorials for Java programmers, we have learned how to parse JSON using JSON-Simple library, parsing JSON array to Java array using GSon, and in this tutorial, we will learn how to parse a large JSON file in Java using Jackson's Streaming API. Jackson is one of the most popular JSON processing frameworks and provides three main models to parse and process JSON data including Streaming API, data binding, and tree model. Out of these three, Streaming works at the lowest level and can be used to parse huge JSON responses up to even gigabytes of size. If you are familiar with XML parsing, then you know that how difficult it is to parse huge XML files with DOM parser because it fully loads the file in memory before you can process it.

Tuesday, September 10, 2024

6 Websites to Learn Linux Command Line for FREE - Best of Lot

Hello guys, if you want to learn Linux online and are looking for free resources to learn Linux commands and concepts, you have come to the right place. Earlier, I have shared Linux and shell scripting courses and tutorials, and in this article, you will find the best places to learn Linux online. Linux is one of the most useful skills for Programmers and Developers, and there are a lot of useful resources on the internet to learn Linux and master Linux command lines or bash shells. In this article, I will share websites where you can learn Linux for FREE. I have tried to include a variety of websites like Udemy and Coursera for online courses, CodeCademy and Educative for online interactive learning, and Pluralsight as a membership-based website. 

How to Ignore Unknown Properties While Parsing JSON in Java? Example

One of the common problems while parsing JSON in Java using Jackson API is that it fails when your JSON contains unknown properties i.e. your Java class doesn't have all the fields corresponding to all JSON properties. For example, if you are consuming JSON from a REST Web Service and tomorrow they added a new field into JSON then your code will break because Jackson will throw UnrecognizedPropertyException and stop parsing JSON. This is troublesome and can cause problems in production if you are not aware. I  have faced this issue when a developer shipped the code to consume data from REST API without properly handling unknown fields.

Sunday, September 8, 2024

How to parse JSON with date field in Java - Jackson @JsonDeserialize Annotation Example

I have read many articles on parsing JSON in Java and most of them give examples where properties are either String or int, there are very few examples, where you will see the JSON string contains a date field and that's one important thing to learn. It's easy to parse JSON in Java using Jackson or Gson with just integer and string field but you need to do a little more work if your JSON contains a date field because everything in JSON is String but Java is a type-based programming language, where Date is a type.

Saturday, September 7, 2024

Top 5 JSON Library Java JEE Developers Should Know- Best of Lot

The JSON format is one of the most popular formats to transfer and exchange data on the web. Almost all RESTful web services take JSON input and provide JSON output but unfortunately, JDK doesn't have built-in support for one of the most common web standards like JSON. As a Java developer if you want to develop a RESTful web service and produce JSON data or if you are developing a client to existing RESTFul web services and want to consume JSON response, you don't need to be disappointed. Fortunately, there are so many open source libraries and APIs available for creating, parsing, and processing JSON response in Java, like Jackson, Google GSon, json-simple, etc.

Friday, September 6, 2024

10 Best Practices to Follow While Writing Code Comments

Comments are an important part of writing code not only in Java but whatever programming or scripting language you use. At the same time, this is one of the most abused things as well. Both writing no comment and writing too much comment is bad and this has been highlighted by many software gurus e.g. Robert C. Martin in his classic book Clean code. There is a whole chapter dedicated to How to write comments and finding the pros and cons of a comment. This article is my learning in the same direction, here I am going to share with you guys some 0f the rule and best practices I follow while writing comments.

6 JDBC Performance Tips for Java Developers

JDBC Performance tips are a collection of some tried and tested ways of coding and applying process which improves the performance of JDBC code. The performance of core Java application or J2EE web application is very important, especially if its user database in the back end which tends to slow down performance drastically. do you experience your java j2ee web application being very slow (taking few seconds to process simple requests which involve database access, paging, sorting, etc) then the below tips may improve the performance of your Java application? these tips are simple in nature and can be applied to other programming language application which uses the database as back-end. 

Dealing with Password in Java Application? 5 Best Practices You Should Follow

While working in core Java applications or enterprise web applications there is always a need of working with passwords in order to authenticate users. Passwords are very sensitive information like Social Security Number(SSN) and if you are working with real human data like in an online banking portal or online health portal it's important to follow best practices to deal with passwords or Social security numbers. here I will list down some of the points I learned and take care of while doing authentication and authorization or working with passwords. I recommend reading more on this topic and have a checklist of things based on your application requirement. Anyway here are few points which make sense to me:

Wednesday, September 4, 2024

How to create Immutable Class and Object in Java - Tutorial Example

Writing or creating immutable classes in Java is becoming popular day by day, because of the concurrency and multithreading advantage provided by immutable objects. Immutable objects offer several benefits over a conventional mutable object, especially while creating concurrent Java applications. Immutable object not only guarantees safe publication of object’s state but also can be shared among other threads without any external synchronization. In fact, JDK itself contains several immutable classes like String, Integer, and other wrapper classes.

What is difference between Enumeration and Iterator in Java? Answer

Though both Iterator and Enumeration allows you to traverse over elements of Collections in Java, there is some significant difference between them e.g. Iterator also allows you to remove elements from the collection during traversal but Enumeration doesn't allow that, it doesn't get remove() method. Enumeration is also a legacy class and not all Collection supports it e.g. Vector supports Enumeration but ArrayList doesn't. On the other hand, Iterator is the standard class for iteration and traversal. By the way,  what is the difference between Enumeration and Iterator in Java? 

Tuesday, September 3, 2024

Dealing with org.hibernate.LazyInitializationException: could not initialize proxy - no Session in Hibernate Java

If you are working in the Hibernate framework, then you know that one of the key features of Hibernate is "lazy initialization", which allows the framework to lazily initialize dependencies, relationships, or associations lazily from the database on a need basis. For example, if you are dealing with a User object, which has a relationship with a Permission object like one user can have multiple permissions, then Hibernate may choose not to initialize the collection which holds all permissions at the time it initialized User object and instead returns a proxy object.

How to fix org.hibernate.MappingException: Unknown entity Exception in Java? Solution

If you have used Hibernate with JPA and using annotation to declare your entity bean then you might have seen this confusing error called "org.hibernate.MappingException: Unknown entity". This error message is so misleading that you could easily lose anywhere between a few minutes to a few hours looking at the wrong places. I was using Spring 3 and Hibernate 3.6 when I got this error, which occurs when addEntity() method was executed. I checked everything, from Spring configuration file applicationContext.xml, Hibernate config file, my Entity class, and DAO class to see whether my Entity class is annotated or not, but I was still getting this error message.

Why JPA Entity or Hibernate Persistence Class Should Not be Final? Answer

One of the interesting hibernate interview questions is, why you should not make a Hibernate persistent class final? I'll try to answer this question in this short blog post. The use of proxies is the core feature of Hibernate (one of the most popular ORM frameworks for Java Projects) for implementing key performance features e.g. lazy loading and lazy associations fetching. In order to use a proxy in place of a real class, your hibernate persistence class must be either non-final or the implementation of an interface that declares all of the public methods. 

Monday, September 2, 2024

10 Difference between Hibernate and JDBC in Java

JDBC is the core technology to access database from Java application but it require lot of boiler plate coding. Hibernate on the other hand an ORM (Object Relational Mapping) framework, which automatically map Java object to tables and records in database. You don't need to execute query to populate objects, Hibernate will do that for you. It also provides several benefit as compared to JDBC e.g. performance improvement via Proxy, lazy loading of associations and Caching, that's why both enterprise Java application and web application uses Hibernate to implement the DAO layer of application.