Mahesh Parahar has Published 253 Articles

Difference between Application context and Beanfactory in Spring framework

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 07:28:36

3K+ Views

Spring framework provides two IOC container for managing, configuring and manipulating beans. One is BeanFactory and the other is Application Context. The application context interface extends BeanFactory to enhance the functionality of BeanFactory. In new Spring versions, BeanFactory is replaced with ApplicationContext. But still, BeanFactory exists for backward compatibility. Spring version 2.0 and ... Read More

Difference between volatile and transient in java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 07:24:40

8K+ Views

A volatile keyword is used in a multithreading environment where two threads reading and writing the same variable simultaneously. The volatile keyword flushes the changes directly to the main memory instead of the CPU cache. On the other hand, the transient keyword is used during serialization. Fields that are marked as ... Read More

Difference between Stack and Heap memory in Java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 07:10:08

6K+ Views

JVM has divided memory space between two parts one is Stack and another one is Heap space. Stack space is mainly used for storing order of method execution and local variables.Stack always stored blocks in LIFO order whereas heap memory used dynamic allocation for allocating and deallocating memory blocks. Memory allocated ... Read More

Difference Between ReentrantLock and Synchronized in Java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 07:06:01

2K+ Views

There are two ways to get a lock on the shared resource by multiple threads. One is Reentrant Lock (Or ReadWriteLock ) and the other is by using the Synchronized method.ReentrantLock class has been provided in Java concurrency package from Java 5. It is the implementation of Lock interface and According ... Read More

Difference between Thread and Runnable in Java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 06:59:00

21K+ Views

There are two ways to create a new thread of execution. One is to declare a class to be a subclass of the Thread class. This subclass should override the run method of the Thread class. An instance of the subclass can then be allocated and started.The other way to ... Read More

Difference between Serialization and Externalization in Java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 06:52:04

3K+ Views

Serialization and externalization both are the processes of converting an object to stream byte and storing byte stream in database or memory. The class which implements java.io.Serializable interface can be serialized. On the other hand, externalization used for custom serialization based on the requirement in the application. Externalization extends java.io.Serializable. Sr. ... Read More

Difference between Concurrent hash map and Synchronized hashmap in Java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 06:43:10

6K+ Views

Concurrent Hashmap is a class that was introduced in jdk1.5.  Concurrent hash map applies locks only at bucket level called fragment while adding or updating the map. So, a concurrent hash map allows concurrent read and write operation to the map. Synchronized hashmap(Collection.syncronizedHashMap()) is a method of Collection framework. This method ... Read More

Difference between Iterator and Enumeration in Java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 06:30:54

6K+ Views

Iterator and Enumeration both are the cursors to traverse and access an element from the collection. They both belong to the collection framework. Enumeration was added in JDK1.0 and Iterator in the JDK.1.2 version in the collection framework. Enumeration can’t make structural changes in the collection because it has read-only access ... Read More

Difference between lazy and eager loading in Hibernate

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 06:20:10

13K+ Views

Lazy and Eager are two types of data loading strategies in ORMs such as hibernate and eclipse Link.  These data loading strategies we used when one entity class is having references to other Entities like Employee and Phone (phone in the employee). Lazy Loading − Associated data loads only when we ... Read More

Difference between Save and SaveAndFlush in Spring Java

Mahesh Parahar

Mahesh Parahar

Updated on 18-Nov-2019 06:14:24

4K+ Views

Save and saveAndFlush both can be used for saving entities. They both are both belong to the Spring data library. save may or may not write your changes to the DB straight away. When we call saveAndFlush system are enforcing the synchronization of your model state with the DB.Sr. No.KeySaveSaveAndFlush1RepositoryIt ... Read More

Advertisements