-->
Skip to main content

Posts

Showing posts from 2020

Solution : Table 'hibernate_sequence' doesn't exist

Table 'hibernate_sequence' doesn't exist  Maven + Eclipse + Hibernate 5 + Java 14 + Mysql and After successful project creation when application starts then hits the following error message  Table 'hibernate_sequence' doesn't exist. Tested with: 1, Hibernate 5.4.26 2. mysql-connector-java-8.0.22.jar 3. Java 14 4. Maven 3.6.3 Caused by: java.sql.SQLSyntaxErrorException: Table 'hibernate.hibernate_sequence' doesn't exist at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003) at org.hibernate.id.enhanced.TableStructure.executeQuery(TableStructure.java:216) at o...

How to Reverse a String in Java [2021]

How to Reverse a String in Java [2021] This tutorial will show how to reverse a string in java using 7 different ways. how to reverse a string in java is a very common question that is being asked in interviews and also with different methods as there is no inbuilt method in the String class for string reversal. Few facts about String class 1. String class is immutable thus any change in string instance creates a new string object. 2. StringBuffer/StringBuilder class has an inbuilt reverse() method. 3. As StringBuffer is synchronized so StringBuilder is preferred over StringBuffer. So let's get started...  Here are the 7 different ways to reverse a string in java Reverse a string in java using for loop. Reverse a string in java using recursion. Using the built-in string reverse function in java of StringBuilder class/StringBuffer class. Converting String to Character Array and then swapping with iteration. Reverse string using the charAt method. Reverse a string in java 8. Re...

Difference between double and float in java [2021]

Difference between double and float in java [2021] Both double  and float  are used to represent floating-point numbers in java, although there are similarities as well as differences between double and float in java. double can provide precision up to 15 to 16 decimal points whereas float provides precision up to 6 to 7 decimal places. double is more expensive in case of storage requirements . It requires 8 bytes to store a variable whereas float takes 4 bytes to store a variable. If memory is a constraint then it's better to use float than double. Here is one of the best book to learn Java: Core Java Volume 1 - Fundamentals by Cay S. Horstmann to learn more about similarities and differences between a float and a double data type in Java.  Let's discuss the differences in detail. Difference between double and float in Java 1. Suffix By default, float numbers are double in java. In order to store them in the float variable, you need to explicitly add the s...

What is Delay Loop in Java?

What is Delay Loop in Java? In this tutorial, we will cover What is Delay loop in java . Delay Loop in Java The word Delay Loop simply refers to a small java program that has an inbuilt delay in execution for certain purposes. For Example: In real-time applications, if we are using third-party Rest Api which runs synchronously so we put some delay between two API calls so that the first API hit response comes back within that time. Code in Action:  public class DelayLoopExample extends Thread { @Override public void run() { for (int i = 1; i <= 10; i++) { System.out.println("Element : "+ i + " is in process : " + LocalTime.now()); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] args) { DelayLoopExample example = new DelayLoopExample(); example.start(); } } Output: Element : 1 is in process : 1...

Kent CamEye Interview Questions in Java

Kent CamEye Interview Questions in Java Today we will discuss Kent CamEye Interview Questions in Java for experienced developers having 3+ Years of Experience. In the earlier post, we had discussed  IRIS Software Interview Questions in Java . Let's see the Kent CamEye Interview Questions now... These questions are solely on the basis of the telephonic interview given by people and collected thereafter. So let's get started... Kent CamEye Interview Questions Telephonic Rounds       Spring Boot Interview Questions What advantages does it provide? what @SpringbootApplication annotation does?          Spring Interview Questions What is Spring bean and explain different bean scopes? If we create two different beans of type Singleton of the same class how spring will behave?     Core Java Interview Questions What is Try with resources in java? Do we need to provide catch and finally with a try with resources? What is the difference b...

Iris Software Interview Questions in Java

Iris Software Interview Questions in Java Today we will discuss Iris Software Interview Questions in Java for experienced developers having 3+ Years of Experience. These questions are solely on the basis of the telephonic interview given by people and collected thereafter. So let's get started... Iris Software Interview Questions Telephonic Rounds       Spring Boot Interview Questions What are the advantages of Spring Boot over Spring? Which different Configuration files are used to define properties? Explain Spring boot Architecture and how it is different than the MVC application? What advantages does Spring boot provide over Spring MVC? How to create an API in Spring Boot Application?      System Design  How you will design APIs for Product flow in e-commerce sites? Hint: For Create Order, Update Order, Edit Order, Delete Order Which Type of APIs you will create Synchronous or Asynchronous and why? Can we do update the Call using GET Method if...

Understanding public static void main in java

Understanding public static void main in java public static void main in java public static void main in java Let's split public static void main in java and understand it one by one. What is public static void main in java public :  public is an access modifier, which specifies from where and who can access this method. public makes the method available globally. public keyword is used before the main method to specify the starting execution point of the program and will be visible to JVM. Example : What will happen if we change public to private or protected or default with no access modifier below is the code snippet for all the three and its output public class JavaCodeGeekMainExample { private static void main(String[] args) { System.out.println("Hello World"); } } public class JavaCodeGeekMainExample { protected static void main(String[] args) { System.out.println("Hello World"); } } public class JavaCodeGeekMainExample { static ...

How to Convert String to Array in Java [2021]

How to Convert String to Array in Java [2021] In today's programming world, We generally need to Convert String to Array in Java, In this tutorial, we will cover how to convert String to Array in Java using two approaches. Using the Split method of String class. Using the  Pattern class compile method with regular expression.  Earlier we have covered different conversion like  Convert to String from Byte Array In Java ,  Convert String to Byte Array in Java  and  Convert Between Java Byte Array to Object In Java  which is also similar to our current requirement. Let's dive in for our current tutorial... How to Convert String to Array in Java  1. Using the Split method of String class. How to convert String to Array in Java Using Split method The split method is used to split the string around the regular expression passed. The split method will convert sampleString "Java Code Geek" to three separate Array Elements Java Code Geek. ...

How to Change Port Number In Tomcat in 2021

How to Change Port Number In Tomcat in 2021 Everyday now and then developers face one problem that port 8080 is already in use thus we have to change the port number of our server, Today we will see how to change port number in tomcat. In the earlier tutorial, we have covered how to add tomcat server in eclipse . How to Change Port Number in Tomcat 1. How to Change Port Number in Tomcat Go to the directory where you have downloaded your tomcat server  For example : C:\Abhishek\Abhishek\java\servers\apache-tomcat-9.0.37 Now go to the conf folder   Apache Tomcat Server Path Now you will see server.xml file under conf folder as shown below Apache Tomcat Server XML Now opens the server.xml file and search for  port="8080" in server.xml file which will take us to this line.  Apache Tomcat Server Connector Port Now change the tomcat default port from 8080 to 9000 or any port you want above 7070 which is unique. Now this  will be lik e  Apache Tomcat Server C...