Free Data Structures and Algorithms Course









Subscribe below and get all best seller courses for free !!!










OR



Subscribe to all free courses

How to create Composite Primary Keys by @Embeddable annotation in Hibernate using JPA ?

Program to demonstrate how to create Composite Primary Keys by @Embeddable annotation in Hibernate using JPA.





Click here to download complete source code 

How to create Composite Primary Keys by @EmbeddedId annotation in Hibernate using JPA ?


Program to demonstrate how to create Composite Primary Keys by @EmbeddedId annotation in Hibernate using JPA.





Click below to Download Source Code -

DOWNLOAD LINK - 1
DOWNLOAD LINK - 2

How to Create - Store - Save - Persist a Java Entity Object in Hibernate using JPA ?.

Program to demonstrate how to Create - Store - Save - Persist a Java Entity Object in Hibernate using JPA.



How to create Composite Primary Keys by @IdClass annotation in Hibernate using JPA ?

Program to demonstrate how to create Composite Primary Keys by @IdClass annotation in Hibernate using JPA.





Click below to Download Source Code -

DOWNLOAD LINK - 1
DOWNLOAD LINK - 2



How to implement Component Mapping by @Embedded annotation in Hibernate using JPA ?.

Program to demonstrate how to implement Component Mapping by @Embedded annotation in Hibernate using JPA.
 




Click below to Download Source Code -

DOWNLOAD LINK - 1
DOWNLOAD LINK - 2







How to update a detached Entity by merge method in Hibernate using JPA ?.

Program to demonstrate how to update a detached Entity by merge method in Hibernate using JPA.



How to delete a Java Entity by its primary key in Hibernate using JPA ?

Program to demonstrate how to delete a Java Entity by its primary key in Hibernate using JPA.



How to create persistence xml file in Hibernate using JPA ?.

A simple video explaining persistence.xml file in JPA.
 



Java Hubberspot Youtube Channel


Java Programming Tutorial Series






JPA - Hibernate Programming Tutorial Series






Design Pattern Tutorial Series





Java Interview Questions and Answers





Spring Interview Questions and Answers





JPA / Hibernate Interview Questions and Answers





How to convert a Java Object into an Entity in Hibernate using JPA ?.

A simple video explaining Entities creation in Hibernate using JPA.
 



How to calculate Exponential of a number in Java using Math class ?.

Program to demonstrate how to calculate Exponential of a number in Java using Math class.



How to declare or make a Java method, class and fields as Deprecated ?.

Program to demonstrate how to declare or make a Java method, class and fields as Deprecated.





Click here to download complete source code 


@Deprecated
public class Calculator {
 
 @Deprecated
 public int sum(int x , int y){
  return x + y;
 }
 
 public int sum(int ... numbers) {
  int sum = 0;
  for(int number : numbers) {
   sum = sum + number;
  }
  return sum;
 }
 
 public static void main(String [] args) { 
  Calculator calculator = new Calculator();
  int result = calculator.sum(5, 10);
  System.out.println("The sum is : " + result);
  
  result = calculator.sum(5, 5, 10, 15);
  System.out.println("The sum is : " + result);
  
 }
 
}



Click here to download complete source code

How to use Javadoc Comments in Java program for Documentation ?.

Program to demonstrate how to use Javadoc Comments in Java program for Documentation.





Click here to download complete source code 


/** 
 * This class demonstrate usage of javadoc comments.
 * 
 * @author Jonty.
 */
public class JavadocDemo {

	/**
	 *  
	 * @param number1 first int value
	 * @param number2 second int value
	 * @return sum of number1 and number2
	 * @throws no exception
	 */
	public int sum(int number1 , int number2) {
		return number1 + number2;
	}

}



Click here to download complete source code 


How to query Environment Variables through a Java Program ?.

Program to demonstrate how to query Environment Variables through Java.





Click here to download complete source code 



import java.util.Map;
import java.util.Scanner;


public class EnvironmentVariables {

 public static void main(String[] args) {
  
  Scanner scanner = new Scanner(System.in);
  
  System.out.print("Enter the name of Environment Variables : ");
  
  String name = scanner.nextLine();
  
  String value = System.getenv(name);
  
  System.out.println(name + " = " + value);
  
  Map < String , String > mapOfEnvironmentVariables = System.getenv();
  
  for(String var : mapOfEnvironmentVariables.keySet()) { 
   
   System.out.println(var + " = " + System.getenv(var));
   
  }  

 }

}



Click here to download complete source code


Output of the program : 


 

How to use Command Line Arguments in Java ?.

Program to demonstrate how to use Command Line Arguments in Java.
 





Click here to download complete source code 
public class CommandLineArguments {

 public static void main(String[] args) {
  
  System.out.print(args[0] + " ");
  
  System.out.print(args[1]);
  

 }

}



Click here to download complete source code

Output of the program :

hello world


How to create a file in Java ?

Program to demonstrate how to create a file in Java.




Click here to download complete source code 


import java.io.File;
import java.io.IOException;

public class CreateFile {

 public static void main(String[] args) {
  
  File file = new File("test.txt");
  
  try {
  
  if(file.createNewFile()) { 
   System.out.println("File successfully created.");
  } else {
   System.out.println("File already exists.");
  }
  
  } catch(IOException ioe) { 
   System.out.println("IO Exception occured.");
  }

 }

}




Click here to download complete source code 


 
© 2021 Learn Java by Examples Template by Hubberspot