Showing posts sorted by relevance for query top-20-spring-mvc-interview-questions-answers-for-java-developers. Sort by date Show all posts
Showing posts sorted by relevance for query top-20-spring-mvc-interview-questions-answers-for-java-developers. Sort by date Show all posts

Friday, January 28, 2011

Top Thirty Saltation Interview Questions In Addition To Answers For Java/Jee Developers

Spring Interview Questions Answers 
Spring Interview Question is i of the get-go things Java programmer should ready earlier appearing on whatever Java or Spring interview. With the immense popularity of Spring frameworks similar Spring MVC as well as Spring Boot inwards Java world, focus on Spring skills on interviews is increasing twenty-four sixty minutes catamenia past times day. For those who don't know, the Spring framework is i of the most pop structures for Java applications, which aims to simplify Java development. It revolutionized the Java evolution when it initially came amongst concepts of  Dependency Injection as well as Inversion of Control, which made writing testable as well as maintainable Java application

But the Spring framework but didn't halt there; it also provides useful API to Java programmers. The best thing is that Spring has been kept evolving since its inception as well as addressing Java developers delineate of piece of occupation concern inwards unlike areas.

Spring framework is divided into many unlike modules similar Spring MVC, Spring Integration, Spring Batch, Spring LDAP, Spring Security, Spring Boot, Spring Cloud, as well as several other modules, which focus on a special area.

For example, Spring Boot tries to acquire inwards fifty-fifty easier to exercise the Spring framework past times reducing the amount of configuration you lot demand to pose inwards for Spring itself. Spring Cloud is evolving to locomote out the best framework for developing cloud-based Java frameworks as well as Microservices, which is a demand for the future, as well as Spring Security has established itself equally the go-to framework for safety Java spider web applications.

Based on your piece of occupation experience, the Interviewer tin give notice enquire questions from heart as well as mortal Spring or these modules. That's why, piece preparing the Spring interview query focus on Spring core, Spring Security, as well as Spring API, these are principal areas from where the interviewer asks questions.

If you lot have got working sense inwards Spring-based Java projects, you lot tin give notice rapidly respond most of these Spring questions from several Java interviews. Still, if you lot don't have got whatever prior sense as well as but learning Spring,  I advise you lot to locomote out through Spring Framework 5: Beginner to Guru course on Udemy to larn Spring fundamentals earlier attempting these questions.





Spring Interview Questions as well as Answers

Now that you lot know the importance of Spring Framework for Java developers as well as ready to have got on Spring questions on your side past times side interview, let's encounter but about often asked questions on the Spring framework on Java interviews:


1) What is the Spring framework? Why Java programmers should exercise the Spring framework? (answer)
Very mutual Spring interview question, Spring is a framework which helps Java programmer inwards development. Spring provides Dependency Injection as well as IOC container, Spring MVC flow, as well as several useful API for Java programmer.


2) What is the default compass of edible bean inwards the Spring framework? (answer)
The default compass of a Spring edible bean is the Singleton scope, as well as inwards the spider web application default compass of a saltation edible bean inwards asking scope. Singleton edible bean way the same instance of a edible bean is shared amongst all other beans, piece asking compass way a edible bean is endure entirely for a request.


3) Does Spring singleton beans are thread-safe?
No, Spring singleton beans are non thread-safe. Singleton doesn't hateful edible bean would be thread-safe.


4) What is the Dependency Injection blueprint pattern? (answer)
Dependency Injection is i of the blueprint patterns, which allows injecting dependency on Objects, instead of object resolving the dependency.


5) What is Inversion of Control concept, how does Spring back upward IOC? (answer)
The unproblematic pregnant of inversion of the command way that at i time the framework, Spring is responsible for creating objects, wiring dependencies, as well as managing their life-cycle instead of a developer, which was the illustration before. That's where command is inverted from developer to framework.


6) What is Spring MVC? Can you lot explicate How i asking is processed? (answer)
Spring MVC is a framework to railroad train Java spider web applications. It provides an implementation of MVC or Model View Controller architecture, which is built on the separation of concerns as well as makes the evolution of Java spider web application easy. In gild to exercise this inwards your project, you lot demand to larn Spring as well as include its JAR file.

Spring MVC framework besides supplies an inbuilt persuasion resolver for selecting views. See Spring Master Class - Beginner to Expert to larn to a greater extent than close how Spring MVC internally works.

 Spring Interview Question is i of the get-go things Java programmer should ready befor Top thirty Spring Interview Questions as well as Answers for Java/JEE Developers



7) What is the View Resolver pattern? how it industrial plant inwards Spring MVC
View Resolver pattern is a J2EE pattern that allows a spider web application to dynamically conduct its persuasion technology, e.g. HTML, JSP, Tapestry, JSF, XSLT, or whatever other persuasion technology.

In this pattern, View resolver holds a mapping of unlike views, controller render cite of the view, which is hence passed to View Resolver for selecting an appropriate view. 


8) How do you lot create a controller inwards Spring? @Controller vs. @RestController? (answer)
Influenza A virus subtype H5N1 controller is cipher but a class, besides known equally a edible bean inwards Spring terminology. If you lot are using annotation, hence you lot tin give notice create a controller past times using @Controller annotation.

For RESTful spider web service, you lot tin give notice besides create REST controllers past times using the @RestController annotation, as well as inwards that case, you lot don't demand to exercise the @ResponseBody musical note explicitly to nation Spring how it needs to respond.

Btw,  if you lot are interested inwards learning to a greater extent than close how to railroad train RESTful Web Service using Spring framework, I advise taking a expect at the REST amongst Spring course by Eugen Paraschiv of Baeldung. It's i of the comprehensive class which non entirely covers basics but besides advanced concept similar versioning, testing, as well as deploying REST API inwards production.


9) What types of dependency injection are supported past times Spring Framework? When do you lot exercise Setter as well as Constructor Injection, the pros as well as cons?
There are two types of dependency injection supported past times Spring, constructor based injection, as well as setter-based injection.

Both types have got their ain advantages as well as disadvantages; you lot should exercise Constructor injection when an object's dependencies are non optional, as well as they must endure initialized amongst their dependencies.

Also, exercise constructor injection if the gild of initialization or dependency matters because, inwards Setter based injection, you lot cannot impose whatever order. Use setter injection when dependencies are optional. See the difference betwixt setter vs. constructor injection inwards Spring for a to a greater extent than detailed answer.


10) Can nosotros exercise to a greater extent than than i configuration file for our Spring project?
Yes, you lot tin give notice exercise equally many equally you lot want, all you lot demand to is import them inwards the principal Spring configuration file which you lot volition charge from your program.


11) What is Spring Security?
Spring safety is a projection nether the saltation framework umbrella, which provides back upward for safety requirements of firm Java projects.

Spring Security, formerly known equally aegis security, provides out of box back upward for creating a login screen, Remember me cookie support, securing URL, authentication provider to authenticate the user from the database, LDAP as well as inwards memory, Concurrent Active Session management back upward as well as much more.

In gild to exercise Spring safety inwards a Spring MVC based project, you lot demand to include spring-security.jar as well as configure it inwards the application-Context-security.xml file, you lot tin give notice cite it whatever you lot want, but brand certain to render this to ContextLoaderListener, which is responsible for creating Spring context as well as initializing dispatcher servlet. You tin give notice farther encounter Learn Spring Security Certification Class larn to a greater extent than close authentication, authorization, as well as session command using Spring Security.


 Spring Interview Question is i of the get-go things Java programmer should ready befor Top thirty Spring Interview Questions as well as Answers for Java/JEE Developers





12) What is the deviation betwixt ApplicationContext as well as BeanFactory inwards Spring framework? (answer)


13) How do you lot telephone band a stored physical care for past times using the Spring framework? (answer)


14) What do the JdbcTemplate as well as JmsTemplate class offering inwards Spring? (answer)
They offering a criterion way to exercise JDBC as well as JMS API, without writing the boiler code required to piece of occupation amongst those API.

15) How do you lot command concurrent Session on Java spider web application using Spring Security? (answer)
You tin give notice exercise Spring Security to command a release of active sessions inwards Java spider web application. Spring safety framework provides this characteristic out of the box, as well as when enabled, a user tin give notice entirely have got i active session at a time.


16) Explain Spring MVC stream amongst a unproblematic illustration similar starting from Container receives a asking as well as forrad to your Java application?
I have got explained to them from start to halt inwards my article how does Spring MVC industrial plant article internally; you lot tin give notice banking company gibe that for a detailed answer.


17) What is the deviation betwixt Spring MVC as well as Spring core?
The Spring MVC is component of the Spring framework, which helps you lot to railroad train Java spider web application using model spider web controller pattern, piece Spring Core provides the Dependency injection as well as Inversion of Control. The Spring Container is component of Spring core.

Both functionalities come upward inwards unlike JAR files. If you lot are developing but a heart as well as mortal Java application using Spring, hence you lot but demand Spring Core, but if you lot are developing a Web application, hence you lot demand spring-mvc.jar equally well. See answer)


24) Difference betwixt @SpringBootApplication as well as @ContextConfiguration musical note inwards Spring Boot? (answer)


25) What is the exercise of DispatcherServlet inwards Spring MVC? (answer)


26) What is the role of InternalResourceViewResolver inwards Spring MVC (answer)


27) What is the deviation betwixt @Autowired as well as @Inject musical note inwards Spring? (answer)


28) Difference betwixt @RequestParam as well as @PathVariable inwards Spring MVC? (answer)


29) Difference betwixt @Component, @Service, @Controller, as well as @Repository annotations inwards Spring MVC? (answer)


30) How to eat RESTful Web Service using Spring MVC? (answer)


31) Difference betwixt @SpringBootApplication as well as @EnableAutoConfiguration annotations inwards Spring Boot? (answer)

These were but about of the Core Spring framework as well as MVC Interview questions from my collection, I have got given brusk answers for most of these Spring interview question. I advise to inquiry to a greater extent than or read along those Spring query to ready for follow-up Spring interview questions. Some Spring MVC questions are tricky similar Struts as well as Spring integration as well as tin give notice endure entirely answered past times experienced Java plan amongst two to 4-year sense inwards the Spring MVC framework.


Further Reading
Spring Framework 5: Beginner to Guru
The 2020 Java Developer RoadMap 
  • 10 Spring MVC as well as REST annotations for Java Programmers 
  • 20+ Advanced Spring MVC Interview Questions 
  • 20 Spring REST Interview Questions for Java developers
  • 10 Java Coding Interview Questions as well as Answer
  • 5 Books to larn Spring Framework better
  • How to implement Role-based access command inwards Spring?
  • Difference betwixt Dependency Injection as well as Factory Pattern
  • 10 Things Java Developers Should Learn 
  • 5 Java as well as Web Development Frameworks You tin give notice learn

  • P.S. - If you lot desire to larn Spring five as well as Spring Boot two from scratch, inwards a guided, code-focused way the I besides advise you lot banking company gibe out Eugen Paraschiv's Learn Spring: The Master Class. He has late launched this class afterward 2.5 years, which is total of exercises as well as examples to farther cement the real-world concepts you lot volition larn from the course.

    Saturday, November 9, 2019

    Top Xl Advanced Java/J2ee Interview Questions Answers For Experienced - Iii To V Years

    I have got shared many posts most Java interview query inward the past times but nothing, especially for back upwardly engineer perspective. Since at that spot are a lot of L1 as well as L2 back upwardly task exists inward BFSI (Banking, Finance, as well as Insurance Industry) as well as they are also for the longer term, I decided to write this post. When you lot move for a back upwardly engineer role, especially for Java application live on it to heart as well as person Java or Java EE application, Interviewer expects you lot know basics of Java as well as tin start/stop the application, come across log files, warning developers, as well as other aspects of the back upwardly e.g. opening conference pair to solve production issues, communicating to stakeholders, as well as involving correct peoples. In this article, I volition percentage questions to assist with technical aspects e.g. the essential skills you lot demand to clear a back upwardly engineer interview.

    Even though you lot volition live on interviewed to back upwardly Java application, it's expected from you lot to know SQL, UNIX, XML as well as other key technologies which you lot volition exercise inward your day-to-day job. In this post, you lot volition notice questions which are asked to banking concern represent whether a candidate has required skills to back upwardly Java application or not.


    39 Interview Questions for Java JEE Support Engineers

    Here is my collection of some of the best interview questions for Java as well as JEE back upwardly professionals. If you lot are working inward production services or supporting Java application, these interview query volition assist you lot to create good on your interview. If you lot moving from evolution to back upwardly role so also these questions volition give you lot a proficient thought most what is expected from a Java JEE back upwardly engineers.

    1) How create you lot banking concern represent your Java procedure is running on Linux? (example)
    You tin banking concern represent past times using "ps" ascendancy as well as "grep" ascendancy e.g. ps -ef | grep "myprocess". The keyword which you lot exercise with grep for search tin live on anything unique to your process, something which appears inward its ascendancy draw e.g. get upwardly of the shape which implements the primary method. You tin also create "ps -ef | grep java" to listing all Java process.



    2) How create you lot banking concern represent how much retention as well as CPU your Java procedure is consuming?
    First, you lot demand to notice the PID of your process, which you lot tin notice past times using the "ps" ascendancy equally shown inward the previous question. Once you lot notice the PID you lot tin exercise the "top" ascendancy to notice the CPU as well as retention usage. Alternatively, you lot tin also exercise the prstat ascendancy equally shown here.


    3) What does -Xmx as well as -Xms parameters mean?
    These are parameters to specify heap size inward Java. The -Xms defines the size of the heap when JVM starts upwardly as well as -Xmx is used to specify the maximum heap size for Java application i.e. your heap cannot grow beyond that as well as JVM volition croak past times throwing OutOfMemoryError if your heap doesn't have got plenty infinite to create novel objects. See here to acquire to a greater extent than most heap retention inward Java.


    4) What is the departure betwixt JVM as well as JRE?
    The JRE stands for Java Runtime Environment as well as JVM stands for Java Virtual Machine. You install JRE to run Java application e.g. Applet or Core Java application or Web server similar Tomcat. The JVM is business office of JRE. See here to acquire to a greater extent than differences betwixt JVM as well as JRE.


    5) What is the departure betwixt JVM as well as JIT? (answer)
    The JVM stands for Java Virtual machine spell JIT stands for Just inward fourth dimension Compiler. The JIT is business office of JVM as well as used to convert the Java bytecode into native machine code which runs faster. There is some threshold gear upwardly if a code runs to a greater extent than than the threshold it becomes the candidate of only inward fourth dimension compilation past times JIT.



    6) How create you lot accept the heap dump of a Java process? 
    There are many ways to accept the heap dump of a Java procedure e.g. Tomcat, but most mutual is past times using tools available inward JDK e.g. jVisualVM, jCmd, as well as jmap. Here is the ascendancy you lot tin exercise to accept the heap dump of Java process:

    $ jmap -dump:live, file=/location/of/heap_dump.hprof  PID

    The heap dump volition comprise all alive objects as well as they are stored inward heap_dump.hprof file. Remember, you lot also demand PID of Java procedure which you lot tin notice past times using "ps" as well as "grep" ascendancy equally discussed inward the source question. You tin come across Java Performance Companion past times Charlie Hunt to acquire to a greater extent than most taking as well as analyzing heap dump inward Java to notice retention leak as well as other retention related errors. 



    7) How create you lot accept a thread dump of a Java process?
    Taking thread dump is easier than taking heap dump because you lot don't demand to call back tool. In Linux, you lot tin only exercise the kill ascendancy to accept the thread dump e.g.

    $ kill -3 PID 

    volition impress the thread dump inward the log file or where System.out is redirected. Similarly, inward Windows, you lot tin exercise Ctrl + Break from the ascendancy prompt. Alternatively, you lot tin also exercise jConsole as well as VisualVM to accept the thread dump of Java application inward both Windows as well as Linux. You tin also read Java Performance The Definitive Guide By Scott Oaks to acquire to a greater extent than most thread dump as well as heap dump.



    8) What is OutOfMemoryError inward Java? How create you lot bargain with that?
    The Java virtual machine throws java.lang.OutOfMemoryError when at that spot is non plenty retention to run the application e.g. no to a greater extent than retention to create novel objects, no to a greater extent than retention to create novel threads etc. The most mutual OutOfMemoryError is the java.lang.OutOfMemoryError: coffee heap space, which comes when at that spot is no to a greater extent than retention left to create a novel object.


    9) What is the departure betwixt 32-bit as well as 64-bit JVM? (answer)
    The primary differences betwixt 32-bit as well as 64-bit JVM are that afterward is designed for 64-bit operating arrangement e.g. Windows 8 or afterward versions of Linux. From Java developer's perspective, the primary departure betwixt them comes from heap size. Influenza A virus subtype H5N1 64-bit JVM virtually has unlimited heap memory equally compared to 4GB of the theoretical bound of 32-bit JVM. If your plan needs to a greater extent than memory, meliorate run it on 64-bit JVM with large heap space. See hither to acquire to a greater extent than most 32-bit as well as 64-bit JVM.



    13) What is Garbage Collector? (answer)
    The garbage collector is a element of Java virtual machine which is responsible for reclaiming retention from dead objects. It's i of the key components as well as allows an application developer to focus on application evolution rather than doing retention management. Some of the pop garbage collectors are a Concurrent Mark-Sweep garbage collector as well as G1 garbage collector inward recent times.


    14) How create you lot analyze a heap dump?
    There are many tools to analyze heap dump inward Java e.g. you lot tin exercise the jhat tool which comes along with JDK. You tin also exercise Eclipse Memory Analyzer to analyze heap dump to notice out whatever retention leak inward Java spell dealing with OutOfMemoryError inward Java. See Java Performance The Definitive Guide By Scott Oaks to acquire to a greater extent than about analyzing Java Heap dump.

     I have got shared many posts most Java interview query inward the past times but zero Top xl Advanced Java/J2EE Interview Questions Answers for Experienced - iii to five Years



    15) What is the departure betwixt Web Server as well as Application Server? (answer)
    The primary departure betwixt Web as well as Application Server comes from the fact that you lot cannot run EJB on the Web server similar Tomcat or Jetty. The application server similar WebLogic as well as WebSphere provides the runtime surroundings for EJB as well as other advanced services required past times Java EE or J2EE specification.


    16) What is the departure betwixt Apache httpd as well as Tomcat?
    Though both httpd as well as Tomcat are products of Apache software foundation, the httpd is to a greater extent than pop as well as used across the spider web as well as non only inward Java world. The httpd is a spider web server which tin serve static HTML files as well as dynamic content using PHP, Perl or Python, spell Tomcat is a Servlet container which provides the runtime surroundings for Servlet as well as JSP. You tin also exercise both Apache httpd as well as Tomcat together inward Java world.


    17) Can you lot exercise Apache as well as Tomcat together?
    Yes, you lot tin exercise Apache as well as Tomcat together. There are many Java spider web application which is fronted past times Apache spider web server to deliver static resources e.g. HTML files, images, configuration files etc. You tin so configure Apache to forwards the asking to Tomcat.


    18) How create you lot start as well as halt Tomcat inward Linux?
    When you lot install Tomcat inward Linux past times unzipping the downloaded package, you lot tin come across that at that spot is a startup.sh as well as shutdown.sh file inward the tomcat/bin directory. These scripts are used to start as well as halt Tomcat inward Linux. These scripts internally telephone phone Catalina.sh, the primary script to start Tomcat engine.



    19) How create you lot start as well as halt Apache inward Linux?
    The Apache server runs equally httpd daemon inward Linux as well as you lot tin either exercise kill command after finding the PID of httpd procedure equally shown hither or you lot tin exercise the apachectl script equally shown below to start as well as halt Apache spider web server inward Linux

    Starting Apache spider web server inward Linux

    $ apachectl start

    Stopping Apache web server inward Linux

    $ apachectl stop

    Restarting Apache spider web server inward Linux

    $ apachectl restart
    or:
    /sbin/service httpd restart

    You mightiness demand root access to create if Apache spider web server is non running on your application account.


    20) What is JDBC?
    The JDBC stands for Java Database connectivity as well as it provides API to connect a database from Java programs. Different Java vendors e.g. MySQL, Oracle, Microsoft SQL Server, PostgreSQL they implement the API as well as provides their driver implementation to allow Java to connect to their database. Since almost every venture application has a database, JDBC is real of import for whatever existent globe projects.


    21) What is the departure betwixt JDBC as well as JNDI?
    As I said inward the previous answer, the JDBC stands for Java Database Connectivity as well as provides APIs as well as guidelines to connect a database from Java, spell JNDI stands for Java Naming as well as Directory Interface as well as provides a logical construction for retrieving resources e.g. database, messaging queues, venture Java beans without knowing their physical house e.g. host or port. You tin register a resources with JNDI as well as so residuum of your application element tin access them using JNDI name. The database connexion puddle is the most mutual resources accessed via JNDI inward web servers similar Tomcat or WebLogic.


    22) What is database connexion pool? (answer)
    As it get upwardly suggests, it only a puddle of database connections. Since creating a novel database connexion inward real-time is an expensive procedure as well as tin potentially deadening downwards the response time, many application maintains a puddle of active database connection. When a request comes inward they retrieve a connexion from the pool, acquire the information from the database as well as so render the connexion dorsum to puddle so that it tin live on reused. This way, response fourth dimension is improved inward most of the Java spider web application. See here to setup a database connexion puddle inward Tomcat using Spring framework.


    23) Your Java application is connected to a Database via a connexion pool. Suddenly your database goes down? Is that an number with your Java application? Do you lot demand to restart your Java application?

    hint: Since your Java application is using a connexion pool, it has active connections to database which volition acquire disconnected i time DB goes down. If you lot attempt to execute a query, you lot volition have Socket errors.



    24) How create you lot shipping spider web service asking from Linux? (answer)
    There are some commands available inward Linux e.g. curl as well as wget which allows you lot to shipping HTTP commands, which you lot tin exercise to telephone phone as well as essay your spider web services from Linux. Particular, Curl is used extensively to essay RESTful Web Services because it tin shipping POST request, GET request, asking with headers as well as also authenticate using both basic as well as digest authentication.

    If you lot are working with REST API, I advise learning curl, it's real convenient to banking concern represent if your API is working properly using curl from the ascendancy line. You tin fifty-fifty write a script to automate those stuff.


    25) What is the departure betwixt HTTP as well as HTTPS? (answer)
    This is i of the mutual as well as like shooting fish in a barrel questions. Of course, you lot know the departure betwixt HTTP as well as HTTPS right? well, HTTP is insecure but HTTPS is secure, the extra "s" is for security, which agency it non exclusively encode as well as encrypt the message earlier sending but also verify the identity of the server past times using  SSL certificates provided past times global certificate government e.g. GoDaddy, Thawte, VeriSign, Digicert, GeoTrust, as well as Comodo.  See here to acquire to a greater extent than how SSL as well as Certifications run inward Java spider web application.


    26) What is the departure betwixt the GET as well as POST method? (answer)
    Another uncomplicated but ofttimes asked query on Java back upwardly interviews. The primary departure betwixt the GET as well as POST is that GET is both idempotent and rubber but POST is not. You tin burn GET asking multiple fourth dimension as well as it volition give the same number but multiple POST submission should ever live on avoided. GET is also used to read information from server as well as POST is used to shipping information to the server.


    27) What is the departure betwixt Servlet as well as JSP? (answer)
    This is some other interesting Java JEE back upwardly Interview Question. Even though both Servlet as well as JSP is used to create dynamic HTML the key departure betwixt them is their purpose. Servlet is meant for Java developers as well as you lot write to a greater extent than Java than HTML as well as that's why it serves equally Controller inward many pop MVC framework e.g. DispatcherServlet inward Spring MVC.

    On the other hand, JSP is designed for HTML developers as well as it's to a greater extent than HTML than Java as well as that's why it is used equally "view" inward MVC frameworks similar Spring as well as Struts. See the link inward the reply for to a greater extent than detailed comparison.



    28) What is the departure betwixt Struts as well as Spring MVC?
    This is i time again a pop as well as ofttimes asked query on Java JEE Interviews. Even though both are pop spider web MVC framework for Java applications, the key departure is that Spring brings dependency injection source as well as Struts brings it afterward using Struts 2.0.

    Spring is also a suite of libraries e.g. you lot acquire Spring Security to implement safety inward your application, so at that spot is Spring Boot, Spring Data, Spring Cloud as well as many to a greater extent than useful libraries nether Spring umbrella.

    answer)
    There are many differences betwixt JDBC as well as Hibernate but the most of import i is that JDBC provides an API to connect to the database as well as execute the query but Hibernate is an ORM (Object Relational modeling) framework, which agency it allows you lot to run with objects spell it takes aid of saving as well as retrieving object from database.

    In short, inward JDBC you lot demand to write SQL queries to acquire as well as shop information from database but inward Hibernate you lot only bargain with objects, Hibernate takes aid of issuing SQL queries to the database.


    30) What is the departure betwixt Stack retention as well as heap? Which i is faster? (answer)
    These are only 2 dissimilar retention areas used to shop dissimilar kinds of variables. The stack is local to every thread spell heap retention is shared alongside all threads. Since Stack is closer to thread as well as unremarkably implemented using CPU registers they are faster than heap memory. The stack is used to shop local variables equally good method telephone phone frames spell heap is used to shop objects as well as shape metadata. See the detailed reply for to a greater extent than points.


    31) What is the departure betwixt TCP/IP as well as UDP protocol? (answer)
    There are several differences betwixt TCP as well as UDP protocol but the most of import of them is that TCP provides a guarantee of message delivery spell UDP doesn't give whatever guarantee. Because of this guarantee TCP sends to a greater extent than messages than UDP as well as thus eat to a greater extent than bandwidth as well as slower than UDP. TCP is also connexion oriented protocol spell UDP is connectionless. See the detailed reply for to a greater extent than points.

     I have got shared many posts most Java interview query inward the past times but zero Top xl Advanced Java/J2EE Interview Questions Answers for Experienced - iii to five Years



    32) Your Java application is connecting to some other Java application (server) running on the remote host as well as listening on port 17865. Now, you lot don't have got access to that remote host to move as well as come across if the procedure is running. How create notice if the server is upwardly as well as running?
    hint: you tin exercise the telnet command



    33) You are supporting a Java spider web application which connects to many heart as well as person Java procedure as well as gets information from them to the distribution to clients? One customer complains that the asking for information is taking also long as well as it's almost similar hung? How create you lot troubleshoot this problem?

    hint: banking concern represent the log, banking concern represent database, banking concern represent the file system


    34) The Java application you lot back upwardly connects to a database via a DNS, which automatically switches to the secondary database server when the primary goes down. You notice that inward the trial of a failover, your Java application is non connecting to secondary DB server? How create you lot troubleshoot this problem?

    hint: banking concern represent which version your Java application is running. Some JRE caches the DNS e.g. JRE 1.6

    answer)
    The deadlock is a status which tin occur betwixt 2 or multiple threads. In this case, each of the thread waits for each other as well as cannot progress. In Java, this unremarkably happens when thread 1 holds the lock required past times thread 2 as well as thread 2 holds the lock required past times thread 1. If your Java plan is hung so it could live on a deadlock. You tin accept a thread dump as well as notice out if whatever thread is waiting for the lock concord past times other as well as vice-versa. You tin also exercise jConsole tool to notice deadlock.


    36) What is the race condition? (answer)
    The race status is some other multithreading as well as concurrency põrnikas which happens due to racing betwixt 2 threads, for example, if i thread is updating a variable as well as minute thread tries to read the value earlier it finished. You tin avoid race weather condition past times properly synchronizing your code.


    37) What is the departure betwixt PATH as well as CLASSPATH? (answer)
    Both are key surroundings variable used past times Java platform, but the key departure betwixt them is that PATH points to the JDK binaries or native libraries e.g. java.exe, spell CLASSPATH points to Java binaries e.g. JAR files, which contains bytecode. PATH is also arrangement marker concept independent of Java but CLASSPATH is purely Java concept as well as used past times JVM to charge classes required past times Java application you lot are running.


    38) How create you lot notice the Java version used past times your application? (answer)
    You tin run the coffee -version ascendancy inward the ascendancy prompt to notice out the version of Java used past times your application. If you lot have got multiple JDK or JRE installed so brand certain you lot exercise the i which is used past times your application.


    39) What is JAVA_HOME surroundings variable? (answer)
    The JAVA_HOME is zero but a user defined surroundings variable which points to the installation directory of JDK. For example, if you lot have got installed JDK inward /opt/jdk_1.6_20 inward Linux so the JAVA_HOME variable volition betoken to this directory. Same goes for Windows or whatever other operating system.


    That's all most 39 essential questions fro Java JEE Support Engineer. It's only a pocket-size gear upwardly of questions you lot tin hold off inward whatever service based companionship or investment banks but does call back to create key skills required for back upwardly engineers e.g. UNIX, SQL, Java, as well as others. In the adjacent business office of this article, I volition percentage some of the ofttimes asked questions from Java Support Engineer on SQL, UNIX, as well as other supporting technologies.


    Other topic based Java Interview questions for to a greater extent than practice
    • 21 Java Inheritance Interview Questions as well as Answers (list)
    • 15 Data Structure as well as Algorithm Questions from Java Interviews (read here)
    • Top 10 Spring Framework Interview Questions with Answers (see here)
    • Top twenty Hibernate Interview Questions as well as Answers (list)
    • 10 JDBC Interview Questions for Java Programmers (questions)
    • 15 Java NIO as well as Networking Interview Questions with Answers (see here)
    • 20 Java Design Pattern Questions asked on Interviews (see here)
    • 10 Struts Interview Questions for Java developers (list)
    • 30 OOP Interview Questions with Answer (see)
    • 19 Method overloading as well as overriding interview questions (see here)
    • 10 ofttimes asked Servlet Interview Questions with Answers (see here)
    • 15 Java Enum based interview questions with answers (read)
    • 10 Oracle Interview Questions for Java developers (see here)
    • Top 10 JSP Questions  from J2EE Interviews (read here)
    • 12 Good RESTful Web Services Questions from Interviews (read here)
    • Top 10 EJB Interview Questions as well as Answers (see here)
    • Top 10 JMS as well as MQ Series Interview Questions as well as Answers (list)
    • 10 Hibernate Interview Questions for Java EE developers (see here)
    • 21 Final modifier interview questions with reply (read)
    • 10 XML Interview Questions for Java Programmers (read here)
    • Top 10 XSLT Interview Questions with Answers (read more)
    • Top 10 Trick Java Interview Questions as well as Answers (see here)
    • Top xl Core Java Phone Interview Questions with answers (list)

    This list of Java interview questions for Java, JEE, as well as J2EE back upwardly engineers should live on plenty to create for whatever Java interview. You tin crevice both fresher as well as sense marker interview past times preparing these Java interview questions, at to the lowest degree source few rounds. If you lot human face upwardly whatever other interesting query which is non inward this list, so delight permit me know via comments as well as I'll add together it.

    Further Learning
    Java Web Fundamentals By Kevin Jones
    Spring Framework 5: Beginner to Guru
    JSP, Servlets as well as JDBC for Beginners: Build a Database App


    Sunday, January 30, 2011

    Top X Saltation Mvc Together With Balance Annotations Alongside Examples For Coffee Programmers

    Hello guys, welcome to my 3rd article on exploring essential annotations from the Spring framework, the most pop framework for Java development. In the offset article, I convey shared some of the most useful Spring Framework annotations, which were based upon Core Spring functionalities similar dependency injection, inversion of control, in addition to configuration, in addition to inward the instant article, nosotros convey learned nigh of import Spring Cloud annotations like @EnableConfigServer, @EnableEurekaSever, in addition to @EnableDiscoveryClient. Now that you lot know those essential Spring annotations it's fourth dimension to motion towards Spring MVC in addition to REST, 1 of the most used parts of Spring Framework.

    In this article, you lot volition acquire some of the essential Spring MVC in addition to REST annotations similar @Controller, @RequestMapping, in addition to @RestController. These annotations are really useful for creating Spring-based Java spider web application in addition to RESTful spider web services.

    I specially similar Spring MVC's back upwardly for developing RESTful spider web services inward Java. As I convey explained inward my before article 7 reasons to utilisation Spring MVC for REST inward Java, it provides convenient annotations similar @RestController, @ResponseBody, in addition to @ResponseStatus to create fully functional REST APIs inward Java.

    In add-on to exploring total Spring MVC annotations similar @RequestMapping, @RequestParam, in addition to @PathVariable, we'll also explore those which are immensely helpful for developing REST APIs inward Java.

    Btw, if you lot convey worked inward Spring MVC thus you lot should already convey some basic ideas nigh these annotations, but if you lot don't convey whatever prior sense in addition to only started amongst Spring framework in addition to Spring MVC thus I propose you lot to offset acquire through a comprehensive course of written report similar Spring Framework 5: Beginner to Guru course of written report on Udemy.  One of the most useful courses on Spring framework.





    10 Spring MVC in addition to REST annotations for Java developers

    Without wasting whatever to a greater extent than of your time, hither is my listing of some of the must-know Spring MVC in addition to REST annotations for Java developers. If you lot convey used Spring MVC to create a spider web application or RESTful applications thus you lot should already move familiar amongst these but if you lot haven't don't worry, you'll acquire inward this article.

     welcome to my 3rd article on exploring essential annotations from the Spring framework Top 10 Spring MVC in addition to REST Annotations amongst Examples for Java Programmers


    Btw, I'll non acquire inward besides much particular nigh roofing every unmarried alternative in addition to functionality of these annotations, only to proceed this article inward reasonable length, but volition give you lot resources similar Spring inward Action majority where you lot tin acquire these annotations in addition to their utilisation inward depth.


    1. @Controller

    This annotation is used to brand a degree every bit spider web controller, which tin conduct maintain customer requests in addition to shipping a reply dorsum to the client. This is a degree flat annotation, which is position on top of your controller class. Similar to @Service in addition to @Repository it is also a stereotype annotation. If you lot are wondering what is the departure betwixt them thus you lot tin also run across this article to acquire to a greater extent than nigh their differences.

    Here is an event of @Controller annotation inward Spring MVC:

    @Controller public class HelloController{ // handler methods }

    This is a uncomplicated controller degree which contains handler methods to conduct maintain HTTP asking for unlike URLs. You don't need to extend a degree or implement an interface to create the controller anymore.



    2. @RequestMapping

    The Controller degree contains several handler methods to conduct maintain unlike HTTP asking but how does Spring map a particular asking to a particular handler method? Well, that's done amongst the assist of the @RequestMapping annotation. It's a method flat annotation which is specified over a handler method.

    It provides the mapping betwixt the asking path in addition to handler method. It also supports some advanced alternative which tin move used to specify split handler methods for unlike types of asking on the same URI similar you lot tin specify a method to conduct maintain GET request in addition to some other to conduct maintain POST asking on same URI.

    Here is an event of @RequestMapping annotation inward Spring MVC:

    @Controller public class HelloControler{    @RequestMapping("/")   public String hello(){     return "Hello Spring MVC";   } }

    In this example, the dwelling page volition map to this handler method. So whatever asking comes to the localhost:8080 volition acquire to this method which volition render "Hello Spring MVC".

    The value attribute of @RequestMapping annotation is used to specify the URL pattern but if at that topographic point are no to a greater extent than arguments thus you lot also omit that.

    You tin also specify the HTTP method using RequestMethod attribute. If you lot are novel to Spring MVC, I propose you lot acquire through  @RequestParam annotation inward Spring MVC from my before article nigh the departure betwixt RequestParam in addition to PathVariable annotation:

    @RequestMapping("/book") world String showBookDetails(  @RequestParam("ISBN") String ISBN, Model model){   model.addAttribute("ISBN", ISBN);   render "bookDetails"; }

    If you lot access your spider web application which provides majority details amongst a query parameter similar below:

    http://localhost:8080/book?ISBN=900848893

    thus inward a higher house handler method volition move called because it is outpouring to the "/book" URL in addition to the query parameter ISBN volition move used to populate the method declaration amongst the same parent "ISBN" within showBookDetails() method.

    You tin fifty-fifty utilisation a unlike parent of your choice. If you lot are interested inward learning to a greater extent than nigh @RequestParam annotation in addition to its diverse options thus Spring MVC For Beginners: Build Java Web App inward 25 Steps on Udemy is a bang-up house to start with.

     welcome to my 3rd article on exploring essential annotations from the Spring framework Top 10 Spring MVC in addition to REST Annotations amongst Examples for Java Programmers



    4. @PathVariable

    This is some other annotation which is used to remember information from the URL. Unlike @RequestParam annotation which is used to extract query parameters, this annotation enables the controller to conduct maintain a asking for parameterized URLs similar URLs that convey variable input every bit portion of their path like:

    http://localhost:8080/books/900083838

    If you lot desire to remember the ISBN let on "900083838" from the URL every bit method declaration thus you lot tin utilisation @PathVariable annotation inward Spring MVC every bit shown below:

    @RequestMapping(value="/books/{ISBN}",                         method= RequestMethod.GET) world String showBookDetails(@PathVariable("ISBN") String id, Model model){    model.addAttribute("ISBN", id);    render "bookDetails"; }

    The Path variable is represented within curly braces similar {ISBN}, which agency the portion later /books is extracted in addition to populated on method declaration id, which is annotated amongst @PathVaraible.

    In short, this annotation binds placeholder from the URI to a method parameter within the handler method. This is immensely useful piece developing RESTful spider web services which contains useful information every bit portion of their URL.



    5. @RequestBody

    This annotation tin convert inbound HTTP information into Java objects passed into the controller's handler method. Just every bit @ResponseBody tells the Spring MVC to utilisation a message converter when sending a reply to the client, the @RequestBody annotations tell the Spring to notice a suitable message converter to convert a resources representation coming from a customer into an object.

    Here is an example:

    @RequestMapping(method=RequestMethod.POST, consumers= "application/json") world @ResponseBody Course saveCourse(@RequestBody Course aCourse){    render courseRepository.save(aCourse); }

    This is 1 time to a greater extent than a really useful annotation piece developing RESTful spider web service inward Java using Spring framework in addition to 1 of the reasons why I dearest to write RESTful API using Spring.

    If you lot are also interested inward developing RESTful application inward Java thus I propose going through Eugen Parachiv's REST amongst Spring Certification class on Baeldung. He has shared his years of sense inward developing REST-based applications using Spring inward this course.




    6. @ResponseBody

    The @ResponseBody annotation is 1 of the most useful annotations for developing RESTful spider web service using Spring MVC. This annotation is used to transform a Java object returned from he a controller to a resources representation requested past times a REST client. It tin completely bypass the persuasion resolution part.

    Here is an event of @ResponseBody annotation inward Spring MVC:

    @RequestMapping(method=RequestMethod.POST,consumers= "application/json") world @ResponseBody Course saveCourse(@RequestBody Course aCourse){   render courseRepository.save(aCourse); }

    This is the same every bit the previous event but the @ResponseBody is used to betoken that the reply returned past times this method volition move converted into a resources which the customer tin consume.

    If you lot convey created whatever RESTful spider web service amongst Spring MVC thus you lot know that nosotros need to annotate each method which generates REST reply amongst the @ResponseBody annotation but amongst the introduction of @RestController, nosotros tin avoid this.




    7. @RestController

    This is convenience annotation for developing RESTful spider web service amongst Spring MVC framework. The @RestController is a combination of @Controller in addition to @ResponseBody, which was introduced inward the Spring 3.4 version.

    When you lot annotate a controller degree amongst @RestController it does 2 purposes, first, it says that the controller degree is treatment a asking for REST APIs in addition to instant you lot don't need to annotate each method amongst the @ResposneBody annotation to signal that the reply volition move converted into a Resource using diverse HttpMessageConverers.

    Here is an event of @RestController annotation inward Spring MVC:

    @RestController class HelloControler{  @RequestMapping("/") public String hello(){   return "Hello Spring Booot"; }  }

    You tin run across that at that topographic point is no @ReseponseBody annotation is required to generate RESTful response. Before @RestController, Java developer used @Controller on top of the degree in addition to annotated each handler method amongst @ResponseBody annotation.

    Spring designer saw this in addition to brand life easier past times introducing @RestController. If you lot are interested, you lot tin acquire to a greater extent than nigh it on RESTful Web Services amongst Java in addition to Spring, a comprehensive course of written report for developing a existent globe in addition to secure REST API amongst Java in addition to Spring.
    You volition also acquire about Implementing API calls, Sign-up, sign-in, e-mail verification, password reset, update, delete in addition to fifty-fifty how to deploy RESTFul Java apps on Amazon AWS Cloud.

     welcome to my 3rd article on exploring essential annotations from the Spring framework Top 10 Spring MVC in addition to REST Annotations amongst Examples for Java Programmers



    8. @SprinbBootApplication

    This is a relatively novel annotation but really useful if you lot are using Spring Boot for creating Java spider web application amongst Spring. This unmarried annotation combines 3 annotations similar @Configuration, @EnableAutoConfiguration, in addition to @ComponentScan. If you lot utilisation Spring Boot, thus you lot tin run your application without deploying into a spider web server, every bit it comes amongst an embedded Tomcat server.

    When you lot annotated your Main degree amongst @SpringBootApplication thus it enables Java-based configuration every bit good every bit ingredient scanning in addition to auto-configuration characteristic of Spring Boot, which tin magically laid things for you lot past times only dropping the required JAR into classpath.

    hither is an event of using @SpringBootApplicaiton annotation inward Spring:

    import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;  @SpringBootApplication  // same every bit @Configuration @EnableAutoConfiguration @ComponentScan public class SpringBootApp{   public static void main(String[] args) {   SpringApplication.run(SpringBootApp.class, args);  }  }

    Since Spring Boot provides many features to brand Java evolution amongst Spring easier, I propose you lot to utilisation Spring Boot going forward. If you lot are novel to Spring kick then Spring Boot MasterClass course on Udemy is 1 of the valuable resources to acquire in addition to original Spring Boot.



    9. @EnableAutoConfiguration

    This is some other Spring kick annotation which enables the auto-configuration feature, which makes Spring jurist the configuration based on the JAR presents inward the classpath.

    This is genuinely the original annotation which was used to enable/disable auto-configuration, nowadays from the really offset liberate of Spring Boot. Since it was constantly used amongst @Configuration in addition to @ComponentScan on an before version of Spring boot, they convey come upwardly up amongst a convenience @SpringBootApplication annotation.

    Though you lot tin yet utilisation @EnableAutoConfiguration annotation if you lot desire to customize or convey some command over auto-configuration.

    For example, you lot tin exclude surely classes from auto-configuration every bit shown inward the next event from my before post nigh the departure betwixt @SpringBootApplication in addition to @EnableAutoConfiguration inward Spring boot:

    @Configuration @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) public class MyConfiguration {   //.. Java code }

    If you lot desire to acquire to a greater extent than nigh this annotation thus Spring Boot inward Action past times Craig Walls is 1 of the best resources to start with.



    10. @ResponseStatus

    This annotation tin move used to override the HTTP reply code for a response. You tin utilisation this annotation for mistake treatment piece developing a spider web application or RESTful spider web service using Spring. Here is an event of @ResponseStatus inspired past times my favorite Spring inward Action book:

    @Exceptionhandler(BookNotFoundException.class) @ResponseStatus(HttpStatus.NOT_FOUND) public Error bookNotFound(BookNotFoundException bnfe){   long ISBN = bnfe.getISBN();   return new Error(4, "Book [" + ISBN + "] non found"); }

    Here nosotros are returning an mistake if the majority for given ISBN is non establish inward our library in addition to nosotros convey used @ResponseStatus to override the HTTP condition code every bit 404 to betoken customer a missing resource.


    That's all nigh some of the essential Spring MVC in addition to REST annotations. As a Java developer, you lot should move familiar amongst these annotations, especially if you lot are using Spring MVC for creating a spider web application or RESTful spider web service inward Java. If you lot desire to acquire to a greater extent than nigh these annotations in addition to diverse options to configure in addition to utilisation them, hither are some resources you lot tin consult.

    Further Learning
    Master Microservices amongst Spring Boot in addition to Spring Cloud
    Top 5Spring in addition to Hibernate Trainign courses
    5 Free Spring Framework in addition to Spring Boot Courses
    15 Spring Boot Interview Questions amongst Answers
    Top 10 Spring Framework Interview Questions
    20 REST amongst Spring Interview Questions for Web developers
    3 ways to acquire Core Spring or Spring MVC better
    6 Courses to acquire Spring Framework inward Depth
    30+ Spring MVC Interview Questions for Java Developers
    How to crevice Spring Core Professional 5.0 Certification

    Thanks for reading this article thus far. If you lot notice these Spring MVC annotations useful thus delight portion amongst your friends in addition to colleagues on Facebook in addition to Twitter. If you lot convey whatever questions or feedback thus delight drib a note.

    Friday, November 1, 2019

    Top Xx Hibernate Interview Questions For Coffee J2ee Programmers

    Hibernate is i of the most pop persistent frameworks inward the Java world. Hibernate offers an object to relational (ORM) solution which frees Java developers from writing tedious, hard to read in addition to cluttered JDBC code converting SQL columns into Object properties. Apart from freeing Java developer from writing JDBC in addition to database interaction code, Hibernate likewise offers the out-of-box solution on caching, proxying in addition to lazy loading which drastically improves the surgical operation of your Java Web application. Given it's of import inward Java Web application evolution patch Hibernate has acquire of i of the most sought-after science in addition to goes manus inward manus amongst Spring framework. That's why Spring in addition to Hibernate interview questions are likewise rattling pop inward Java interviews, especially for spider web evolution positions.

    Earlier I direct hold shared to a greater extent than or less Spring MVC interview questions in addition to due to pop demand, I am straight off sharing some 20 oft asked Hibernate questions from diverse Java interviews.

    These questions are rattling useful for both the telephone in addition to the face-to-face circular of interviews in addition to both beginners in addition to experienced Java developers upwards to 2 to five years tin do goodness from these questions.

    If you lot are actively preparing for Java interviews than you lot tin likewise banking enterprise check out Java Programming Interview Exposed, it non entirely contains interview questions from Spring in addition to Hibernate but likewise other of import Java topics e.g. heart Java, information construction in addition to algorithms, Servlet, JSP, JSF, in addition to pattern patterns.

    Since no listing is consummate without user involvement, thus if you lot direct hold seen whatever practiced Hibernate questions on your interviews, which is non on this listing in addition to then experience costless to part amongst us.

    You tin likewise part your ain questions for which you lot are looking answers or you lot experience it's a practiced inquiry to live asked on Java JEE programming interviews.

    Btw, I await that you lot direct hold to a greater extent than or less Hibernate experience in addition to cognition before you lot cash inward one's chips through this listing of questions otherwise it would live quite dorsum in addition to forth for. If you lot are a beginner to Hibernate, I propose you lot to showtime cash inward one's chips through a course of education like Spring in addition to Hibernate for Beginners which provides all the key cognition inward quick time.

    After that you lot tin meliorate sympathise the points interviewers are looking in addition to these questions volition likewise brand feel to you.




    20 Hibernate Questions from Java JEE Interviews

    Here is my selected listing of xx Hibernate based questions for Java developers. It contains questions from Hibernate fundamentals, one-to-one, in addition to one-to-many mappings, caching, Hibernate vs JDBC comparison, pros in addition to cons of Hibernate, known problems amongst Hibernate, in addition to Performance improvement.


    1. What is Hibernate?
    Hibernate is an ORM (Object-relational Mapping) framework, which allows the developer to concentrate on concern logic past times taking attention of the persistence of information past times itself. Java developer tin write code using object in addition to Hibernate tin direct hold attention of creating those object from information loaded from the database in addition to saving update dorsum to the database.


    2. What are the advantages of Hibernate over JDBC? (detailed answer)
    Apart from Persistence i.e. saving in addition to loading information from Database, Hibernate likewise provides the next benefits
    1) Caching
    2) Lazy Loading
    3) Relationship management in addition to provides code for mapping an object to the data
    4) The developer is costless from writing code to load/store information into the database.


    3. Difference betwixt get() vs load() method inward Hibernate? (detailed answer)
    This is i of the most oft asked Hibernate interview questions, I direct hold seen it several times. The key deviation betwixt the get() in addition to load() method is that load() volition throw an exception if an object amongst id passed to them is non found, but get() volition render null.

    Another of import deviation is that charge tin render proxy without hitting the database unless required (when you lot access whatever attribute other than id) but get() always cash inward one's chips to the database, thus sometimes using load() tin live faster than the get() method.

    Use the load() method, if you lot know the object exists, and get() method if you lot are non certain close the object's existence. See detailed answer)
    The principal deviation betwixt save() in addition to persist() method is that, salve returns a Serializable object spell render type of the persist() method is void, thus it doesn't render anything.

    Here is a overnice diagram which explains the land transition inward Hibernate:

     Hibernate is i of the most pop persistent frameworks inward the Java globe Top xx Hibernate Interview Questions for Java J2EE Programmers



    7. What is the requirement for a Java object to acquire a Hibernate entity object? (detailed answer)
    It should non live concluding in addition to must furnish a default, no-argument constructor. See the detailed respond to acquire to a greater extent than close the special requirement for a Java object to acquire a Hibernate Entity.



    8. What are dissimilar types of caches available inward Hibernate? (detailed answer)
    This is to a greater extent than or less other mutual Hibernate interview question. Hibernate provides the out-of-box caching solution but at that spot are many caches e.g. showtime marking cache, instant marking cache, in addition to query cache.

    The showtime marking cache is maintained at Session marking in addition to cannot live disabled but the instant marking cache is required to live configured amongst external cache provider similar EhCache.


    9. What is the deviation betwixt the showtime in addition to instant marking cache inward Hibernate? (detailed answer)
    This is in i trial to a greater extent than follow-up of previous Hibernate interview question. The showtime marking cache is maintained at Session marking spell the instant marking cache is maintained at a SessionFactory marking in addition to shared past times all sessions. You tin read these books to acquire to a greater extent than close caching inward Hibernate.


    10. Does Hibernate Session interface thread-safe inward Java? (detailed answer)
    No, Session object is non thread-safe inward Hibernate in addition to intended to live used with-in unmarried thread inward the application.



    11. Does SessionFactory thread-safe inward Hibernate? (detailed answer)
    SessionFactory is both Immutable in addition to thread-safe in addition to it has only i unmarried event inward Hibernate application. It is used to do a Session object in addition to it likewise provides caching past times storing SQL queries stored past times multiple session.

    The instant marking cache is maintained at SessionFactory level. This tin live a hard in addition to tricky inquiry for less experienced Java developers who are non familiar amongst thread-safety in addition to Immutability.


    12. What is dissimilar betwixt Session in addition to SessionFactory inward Hibernate? (detailed answer)
    This is to a greater extent than or less other pop Hibernate interview question, generally at a telephonic circular of interviews.

    The principal deviation betwixt Session in addition to SessionFactory is that the sometime is a single-threaded, short-lived object spell afterward is Immutable in addition to shared past times all Session.

    It likewise lives until the Hibernate is running. Another deviation betwixt Session in addition to SessionFactory is that sometime provides showtime marking cache spell SessionFactory provides the Second marking cache.


    13. What is touchstone query inward hibernate? (detailed answer)
    Criteria is a simplified API for retrieving entities past times composing Criterion objects likewise known every bit Criterion query.

    This is a rattling convenient approach for functionality similar "search" screens where you lot tin filter information on multiple weather condition every bit shown inward the next example:

    List books = session.createCriteria(Book.class) .add(Restrictions.like("name", "java%") ) .add(Restrictions.like("published_year", "2015")) .addOrder(Order.asc("name") ) .list();
    This tin live a tough inquiry if you lot are non using Hibernate on a daily basis, I direct hold interviewed several Java developers who direct hold used Hibernate but doesn't know close Criterion query or API. You tin banking enterprise check out this listing of 5 Hibernate in addition to JPA courses for Java Programmers to acquire to a greater extent than close JPA in addition to Hibernate.


    14. What are other ORM frameworks? Any option of Hibernate?
    This is a full general question, sometimes asked to start the conversation in addition to other times to complete the interview. EJB in addition to TopLink from Oracle are 2 of the most pop option to Hibernate framework.


    15. What is the deviation betwixt save() in addition to saveOrUpdate() method of Hibernate? (detailed answer)
    Though both save() in addition to saveOrUpdate() method is used to shop an object into Database, the key deviation betwixt them is that salve tin entirely INSERT records but saveOrUpdate() tin either INSERT or UPDATE records.



    16. What is deviation betwixt getCurrentSession() in addition to openSession() inward Hibernate? (detailed answer)
    An interesting Hibernate interview inquiry every bit you lot mightiness direct hold used both getCurrentSession() in addition to openSession() to obtain an event of the Session object. I direct hold left this inquiry unanswered for you lot to respond or discovery an respond based on your experience.


    17. What is Hibernate Query Language (HQL)? (detailed answer)
    Hibernate query language, HQL is an object-oriented extension to SQL. It allows you lot to query, store, update, in addition to yell back objects from a database without using SQL.

    This inquiry is likewise similar to the before inquiry close Criterion query, Java developers who direct hold non used Hibernate extensively volition non know much close features similar HQL in addition to Criterion.


    18. When do you lot occupation merge() in addition to update() inward Hibernate? (detailed answer)
    This is i of the tricky Hibernate interview questions. You should occupation update() if you lot are certain that the Hibernate session does non comprise an already persistent event amongst the same id in addition to occupation merge() if you lot desire to merge your modifications at whatever fourth dimension without considering the land of the session. See Java Persistence amongst Hibernate for to a greater extent than details.

     Hibernate is i of the most pop persistent frameworks inward the Java globe Top xx Hibernate Interview Questions for Java J2EE Programmers



    19. The deviation betwixt sorted in addition to ordered collection inward Hibernate? (detailed answer)
    The principal deviation betwixt sorted in addition to ordered collection is that sorted collection form the information inward JVM's heap retentivity using Java's collection framework sorting methods spell the ordered collection is sorted using gild past times clause inward the database itself.

    Influenza A virus subtype H5N1 sorted collection is to a greater extent than suited for pocket-size dataset but for a large dataset, it's meliorate to occupation ordered collection to avoid OutOfMemoryError inward Java application.


    20. How do you lot log SQL queries issued past times the Hibernate framework inward Java application?
    You tin occupation the show_sql holding to log SQL queries issued past times the Hibernate framework, Just add together the next business inward your Hibernate configuration file:

    <property name=”show_sql”> true </property>


    21. What are the 3 states of a Hibernate Persistence object tin be? (detailed answer)
    The Hibernate persistent or entity object tin alive inward the next 3 states:
    1) transient
    2) persistent
    3) detached


    22. What is the deviation betwixt the transient, persistent in addition to detached land inward Hibernate? (detailed answer)
    New objects created inward Java programme but non associated amongst whatever hibernate Session are said to live inward the transient state.

    On the other hand, an object which is associated amongst a Hibernate session is called Persistent object. While an object which was before associated amongst Hibernate session but currently it's non associate is known every bit a detached object.

    You tin telephone band save() or persist() method to shop those object into the database in addition to convey them into the Persistent state. Similarly, you lot tin re-attach a detached object to hibernate sessions past times calling either update() or saveOrUpdate() method. See Spring in addition to Hibernate for Beginners to acquire to a greater extent than close persistence object's lifecycle inward Hibernate.


    23. Which cache is used past times Session Object inward Hibernate? First marking or instant marking cache? (detailed answer)
    Influenza A virus subtype H5N1 Session object uses the first-level cache. As I told before the instant marking cache is used at SessionFactory level. This is a practiced inquiry to banking enterprise check if the Candidate has been working inward hibernate or not. If he has non worked inward Hibernate from a long fourth dimension in addition to then he would acquire confused inward this question.


    That's all inward this listing of Hibernate Interview inquiry for Java in addition to JEE developers. In this article, nosotros direct hold covered a lot of oft asked Hibernate inquiry for both beginners in addition to experienced Java developers from all of import topics of Hibernate framework e.g. Hibernate fundamentals, caching, collection mapping, surgical operation tuning, mutual issues in addition to Hibernate vs JDBC.

    If you lot discovery that you lot lack cognition inward whatever exceptional area, I propose cash inward one's chips through next resources to fill upwards those gaps inward your knowledge.

    Further Learning
    Top xx Spring MVC Interview Questions 
    Top xx Spring in addition to REST Interview Questions 
    5 Courses to Learn Spring Boot in addition to Microservices
    5 Hibernate in addition to JPA courses for Java Programmers
    5 Free Courses to acquire Spring in addition to Spring Boot
    Top five Spring in addition to Hibernate  Training courses
    130+ Java Interview Questions from lastly five years
    100+ Data Structure in addition to Algorithm Questions

    Thanks for reading this article, if you lot similar this article in addition to interview inquiry in addition to then delight part amongst your friends in addition to colleagues. If you lot direct hold whatever inquiry or feedback in addition to then delight drib a comment.