In this tutorial I will discuss what are the states of objects (transient persistent and detached objects) in Hibernate framework. You might be knowing that Hibernate is an ORM (Object Relational Mapping), which is an automated persistent of objects in a Java application to the tables in a relational database. Hibernate defines and supports three…

Posted in Hibernate

Hibernate Object States – Transient, Persistent and Detached

Here we will discuss about how an entry gets garbage collected from WeakhashMap. You may check first how garbage collection works in Java. WeakHashMap uses a special class called WeakReference to refer to the keys. A weak reference is an object that acts like an indirect reference (a reference to an object holding another reference)….

Posted in Java

How Garbage Collection works in WeakHashMap

In this tutorial we will see the difference between StringJoiner and String.join(). These were introduced into Java 8 version. The example we create here will show how to join multiple string objects or literals or list of strings using append(), StringJoiner, String.join() API. Situation may occur when you need to join multiple string literals or…

Posted in Java

How to join multiple strings using append(), StringJoiner, String.join() in Java

Introduction In this tutorial we will discuss about the differences among save(), saveOrUpdate() and persist() method in leading ORM(Object Relational Mapping) tool Hibernate framework. The key thing is all these methods are used to store object(s) into database and they also make transient object(s) into persistent. Hibernate framework’s Session class provides a few ways to…

Posted in Hibernate MySQL

save(), saveOrUpdate(), persist() in Hibernate

Deadlock describes a situation where two or more threads are blocked forever, waiting for each other. Java deadlock situation arises with at least two threads(multitasking or multi-threading) and two or more resources. There are several ways you can detect deadlock in Java application.

Posted in Java

How Deadlock occurs and how to fix it in Java

In this tutorial I will discuss about the join() method from Thread class. This method is important method from Thread class and it imposes order on execution of the threads. Therefore join() method ensures that multiple threads run in sequence, i.e., in the same order the threads were started. Let’s say threads t1, t2, t3…

Posted in Java

How to execute Java Threads in the same Order they were started using join() Method

We will discuss here what are the purpose of wait(), notify() and notifyAll() methods in Java. These methods are used in inter-thread communication. Each thread in Java has its own separate path of execution, so when you need to establish communication among threads then you need to use these methods. Let’s say a thread wants…

Posted in Java

Inter Thread Communication using wait(), notify() and notifyAll() in Java

Here we are going to discuss about the StrongReference, PhantomReference, WeakReference and SoftReference. Reference classes are important in the context of how garbage collection works in Java memory model. Garbage collector reclaims memory from objects which are eligible for garbage collection and this eligibility is decided upon what kind if reference is pointing to the…

Posted in Java

What are WeakReference, SoftReference, StrongReference, PhantomReference in Java

Introduction In this tutorial we will see an example on how to find unique strings or objects using Java stream API. Stream API was introduced in Java 8 and we are going to see how to use this stream API to remove duplicates from strings or objects. Java stream API has a method distinct() that…

Posted in Java

How to find unique strings or objects using Java stream API

Introduction In this tutorial we will see how to check broken links in website using Selenium web driver. Broken links are not reachable or simply do not work. A URL for the website is no longer available. A URL of the web page was moved without a redirect being added. The URL structure of a…

Posted in Java Selenium Web

How to check broken links in Website using Selenium Web Driver

Introduction Jenkins Pipeline (or simply “Pipeline”) is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins. A continuous delivery pipeline is an automated expression of your process for getting software from version control right through to your users and customers. Jenkins Pipeline provides an extensible set of tools for modeling…

Posted in Java Jenkins

How to create Jenkins Pipeline for Java Project

Introduction In this tutorial we will show you how to merge string values from two arrays and produce the final array with unique string values. We will use Set data structure to produce the unique results in final array. When passed two arrays of strings, it will return an array containing the string values that…

Posted in Java

Merge Two String Arrays and Produce Unique Values using Java