Skip to main content

Posts

JPA Entity Manager Details | How we can make the id field of the string type a primary key?

  How we can make the id field of the string type a primary key? Entity id   @Id @GeneratedValue (strategy = GenerationType. IDENTITY ) private String id ; Trying to save  Student student = new Student() ; student.setId( "tetasasa" ) ; student.setName( "Peter Smith" ) ; student.setEmail( "peter.smith@gmail.com" ) ; student.setAddress( "New York, USA" ) ; student.setPhone( "123456-2111" ) ; studentRepository .save(student) ; Error Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: org.example.entities.Student Solution   @Id @GeneratedValue(generator="system-uuid") @GenericGenerator(name="system-uuid", strategy = "uuid") private String id; For more details about id generation please refer this - https://thorben-janssen.com/jpa-generate-primary-keys/

Java generics ? super Type and ? extends Type

Hy All, in this post, going to tell you real-time scenario when you use super and extends ? super C This indicates the lower bound, what exactly means that it can hold a list of object which is super to type C or C ? extends A This indicates the upper bound, what exactly means that it can hold a list of object which is a child to type A or A. Below is provided an example for the same, package com.vinay.stock.poc; import java.util.ArrayList; import java.util.List; /** * @author 912vi */ public class GenericDemo { public static void main(String[] args) { List<A> list = new ArrayList<>(); list.add( new A()); list.add( new B()); list.add( new C()); test2 (list); List<B> list1 = new ArrayList<>(); list1.add( new B()); list1.add( new C()); test2 (list1); /* List<AA> list2 = new ArrayList<>(); test2(list2);// compile time error because upper boun

Spring Boot App Deployment Automation Via Jenkins to Tomcat Server

Table of content       Introduction       Required Technology       Create a Spring Boot Project       Push Application to Git repository       Deploy Spring Boot Project to Tomcat Container For Testing       Install Jenkins       Jenkins Setup for Maven, Java, Git, Tomcat, Email trigger.       Setup of Job For the SpringBoot App        Introduction :-  Hi All, The agenda of this post is to get basics information about how we can make our app from scratch and do the setup for the automatic deployment via Jenkins in Tomcat container, so that whenever developers do code checking into the codebase automatic build trigger and latest code get deployed to tomcat container. In this tutorial, we will see how can we develop a spring boot project from scratch,  how we can push this project to Github, what are the steps to deploy this app to stand-alone running tomcat containers. By the above steps are making sure that our application is running fine and we are
Grid View Of Important links  In this post, I am going to show you how you can set your Customized  Web Page as your  Web Browser Default page,  Do you want to Centralized View of your important links? this post is for you  Please refer the link below and download developed software to generate your Important links  as in form  of Grid view Page, and set this Page as your Browser default web page for every time  Easy access and utilize your important time  Link -https://sites.google.com/site/happytosharewithyou912/PageGenerator.zip?attredirects=0&d=1

Best Pattern Printing Code Ever Seen

int main ( void ) { // your code goes here int a , b , c ; for ( b = 10 , c = 10 ; a = "- FIGURE?, UMKC,XYZHello Folks, \ TFy!QJu ROo TNn(ROo)SLq SLq ULo+ \ UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^ \ NBELPeHBFHT}TnALVlBLOFAkHFOuFETp \ HCStHAUFAgcEAelclcn^r^r \\ tZvYxXy \ T|S~Pn SPm SOn TNn ULo0ULo#ULo-W \ Hq!WFs XDt!" [ b +++ 21 ] ; ) for ( ; a -- > 64 ; ) putchar ( ++ c == 'Z' ? c = c / 9 : 33 ^ b & 0x1 ) ; return 0 ; } Output: !!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!

Clicking the Web Element and Scraping the Details

Hi, guys in this Tutorials I am going to show you how to click a web element and scrap the details. Follow the below steps  1. Create a Java project and download the jars  selenium-server-standalone-2.41.0.jar 2.Add the downloaded Jar in your project. 3.Download the Chrome Drive for use in the program below. 4 Create the program for scraping import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Demo1 { public static void main(String[] args) throws InterruptedException { //first paramter is driver name and second is driver's path System.setProperty("webdriver.chrome.driver", "C:\\New_Teslra\\DemoTipschromedriver\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://google.co.in"); driv