Skip to main content

Posts

Hibernate interview questions

Question : Why JPA Entity or Hibernate Persistence Class Should Not be Final?  Answer : One of the interesting hibernate interview questions is, why you should not make a Hibernate persistent class final? I'll try to answer this question in this short blog post. The use of proxies is the core feature of Hibernate (one of the most popular ORM frameworks for Java Projects) for implementing key performance features e.g. lazy loading and lazy associations fetching. In order to use a proxy in place of a real class, your hibernate persistence class must be either non-final or the implementation of an interface that declares all of the public methods. Difference between save vs persist and saveOrUpdate in Hibernate Save vs. saveOrUpdate vs. persist in Hibernate? What is the difference between save and saveOrUpdate or Difference between saving and persist are common interview question in any Hibernate interview, much like the difference between get and load method in Hibernate. Hibern

Password Keeper - Secret Diary - Offline Password keeper - Secret Manager - MySecrets -PNSoft - password manager

You might be having account in many banks or other websites for which you cannot remember passwords, there’s simply no way to easily remember every single password without duplicating passwords. This is where a password manager comes in—as long as you create a strong master password that you can remember, that’s the last password you’ll need to deal with. One Key to ALL Locks :) Data breaches are caused by weak or reused passwords. To keep your information secure, you need a strong, unique password for every account. But when you have hundreds of accounts, how do you keep track of all your passwords? That’s where password managers come in. They help you create one master password which will keep your all your passwords.  MySecrets -PNSoft   is a  free and password manager  primarily for  Windows .  MySecrets -PNSoft stores usernames, passwords, and other fields, including free-form notes in an encrypted  file . This file can be protected by any combi nation of a master password, a k

Word Break Problem - auto separate the words from a given string checking dictionary.

Word Break Problem - auto separate the words from a given string checking dictionary. Function to segment given String into a space-separated sequence of one or more dictionary words import java.util.Arrays; import java.util.List; public class TestMain { // Function to segment given String into a space-separated // sequence of one or more dictionary words public static void wordBreak(List<String> dict, String str, String out) { // if we have reached the end of the String, // print the output String if (str.length() == 0) { System.out.println(out); return; } for (int i = 1; i <= str.length(); i++) { // consider all prefixes of current String String prefix = str.substring(0, i); // if the prefix is present in the dictionary, add prefix to the // output String and recur for remaining String if (dict.contains(prefix)) { wordBreak(dict, str.substring(i), out + " " + prefix

upload a existing project from system to github

How to upload a existing project from system to github? Here, I will show a live example to upload a existing project from your machine to github. First of all I want you to understand that you should or can't upload your existing project directly to git hub website using github UI, as they dont provide any UI option to upload whole project at once. You need to install git hub on your system and then you can upload your project using shell/terminal/cmd. To download git click here --> https://git-scm.com/download/win Once it is installed, you need to create an git ccount or login to your git account if you already have. and then go to repositories create your new project repositories by your project name. you will see this below: , copy this line, you will need it. git remote add origin https://github.com/Prittz/Test1234.git git push -u origin master Now, go to the project folder on your system. and open terminal/cmd on that location. and the

Count each character and sort the string

Here we have shown how to count the character occurrence in the string and print in sorted way For example, you have a string : input : bbcann and your output would be 1b2c1n2 , means you have counted and also printed in sorted way from a to z. This is commonly asked questions on online test. public class App  {     public static void main( String[] args )     {         System.out.println( "Hello World!" );         System.out.print(countChracter("bbcann"));     }              static String countChracter(String s){     char[] carray=s.toCharArray();     Arrays.sort(carray);     HashMap<Character,Integer> hm = new HashMap<Character, Integer>();     for(char c : carray){     if(hm.containsKey(c)){     hm.put(c, hm.get(c)+1);     }else{     hm.put(c, 1);     }         }     String output="";     for(Map.Entry e: hm.entrySet()){     output=output+e.getKey()+e.getValue();     }     ret

C variable format to Java Variable String format : snakeCase to java convention and vice versa

How to convert snake case format containing underscore to java variable format and vice versa?  Usually c variable contains underscore between words but java contains firstletter is lowercase and other first letter in upper case. This is very famous test program usually asked in online test. example :  input = bb_cann_fb_hnh output = bbCannFbHnh and vice versa. public class VariableFormatter { public static void main( String[] args )     {         System.out.println(modifyVariableString("bb_cann_fb_hnh"));         System.out.println(modifyVariableString("bbCannFb"));           }        private static String modifyVariableString(String s) {    String output; //check if it is c variable    if(s.contains("_")){    output= javaFormatter(s);    }else{    output= cFormatter(s);    } return output; } private static String cFormatter(String string) {    string= string.replaceAll("([A-Z])", "

Camunda Spring Boot with Shared Engine with War file

This is the only one website (may be first) to show an example to create working war file for camunda shared engine using Spring Boot. We analysed the problem using pure spring boot "starter" dependencies that it contains camunda engine plus tomcat, so even when you remove tomcat using either <provided> or <exclude>, it continues to run on tomcat as its already with in camunda engine. And when you try to create war file and paste in into shared camunda engine outside then that war will no work. This is because that war you created containing camunda engine and a tomcat inside it and when you paste into another outside camunda engine, it gets confused to which camunda to use. Hence I worked on this and brought a mix version of spring and spring boot implementation of camunda. So here you go....and thanks me later :) Here is the pom file -------------------------------------------------------------------------------------------- <?xml version=&