Hibernate JDBC Driver Connection URL strings

Below are the details of connection properties while connecting with different database. Oracle To connect with Oracle database JDBC connection properties look as follows: JDBC Driver oracle.jdbc.OracleDriver JDBC Url jdbc:oracle:thin:@localhost:1521/oradb Hibernate Dialect org.hibernate.dialect.Oracle12cDialect   MySQL To connect with MySQL database JDBC connection properties look as follows: JDBC Driver com.mysql.jdbc.Driver JDBC Url jdbc:mysql://localhost/upsilonwin_db Hibernate Dialect org.hibernate.dialect.MySQL57Dialect […]

Continue Reading

Algorithm: Quick Sort

Quick sort is comparison sort based on divide and conquer approach. It is in-place sorting algorithm so it require small additional amount of memory to perform sorting. Quick sort was developed by Tony Hoare in 1959. Complexity(Big O notation) Best-case  – O(n log n) Average-case – O(n log n) Worst-case – O(n²) Quicksort or partition-exchange sort, […]

Continue Reading

Important Questions on Java Serialization Asked in Interviews

What is Serialization in Java? How to make a Java class Serializable? What is the difference between Serializable and Externalizable interface in Java? How many methods Serializable interface has? If no method then what is the purpose of Serializable interface? What is serialVersionUID? While serializing you want some of the members not to serialize? How […]

Continue Reading

Why there are only Run-time exception in Spring ? 

Lets first understand the best practices regarding handling Exceptions while designing an API or framework. If the client can take some alternate action to recover from the exception, make it a checked exception. If the client cannot do anything useful, then make the exception unchecked. By useful, I mean taking steps to recover from the exception and […]

Continue Reading

Design Pattern: Strategy Design Pattern in Java with Example in JDK

Strategy design pattern is one of the behavioral design pattern. Strategy pattern is used when we have multiple algorithm for a specific task and client decides the actual implementation to be used at runtime. Strategy pattern is also known as Policy Pattern. One of the best example of strategy pattern is 1Collections.sort(anyCollection, Comparator implemetation)  method that takes […]

Continue Reading

How to achieve Singleton using Enum in Java?

A singleton is a class that is supposed to have only one instance per JVM. The Same instance of the singleton class is reused by multiple threads.   12345678910public enum SingletonUsingEnum { INSTANCE; int value; public int getValue() { return value; } public void setValue(int value) { this.value = value; } } And in Your main […]

Continue Reading

Difference between Java Singleton and Spring Singleton?

There is common misunderstanding between Spring Singleton and Java Singleton classes.  If you don’t know Singleton design pattern Please read Singleton Design pattern first. Java singleton class is per Classloader and Spring’s singleton is per application context. Java considers something a singleton if it cannot create more than one instance of that class within a […]

Continue Reading