Table of contents
- 1) What is J2EE?
- 2) What are the four components of J2EE application?
- 3) What are types of J2EE clients?
- 4) What are considered as a web component?
- 5) What is JSF?
- 6) Define Hash table
- 7) What is Hibernate?
- 8 ) What is the limitation of hibernate?
- 10) What is ORM?
- 11) Difference between save and saveOrUpdate
- 12) Difference between load and get method?
- 13) How to invoke stored procedure in hibernate?
- 14) What are the benefits of ORM?
- 15) What the Core interfaces are of hibernate framework?
- 16) What is the file extension used for hibernate mapping file?
- 17) What is the file name of hibernate configuration file?
- 18) Define connection pooling?
- 19) What is the hibernate proxy?
- 20) What is HQL?
- 21) What are the Collection types in Hibernate ?
- 22) What is a thin client?
- 23) Differentiate between .ear, .jar and .war files
- 24) What are the JSP tag?
- 26) What is the EAR file?
- 27) What is Struts?
- 27) What is the MVC on struts?
- 28) What are different modules in spring?
- 29) What are the Benefits Spring Framework ?
- 30) How to Create Object without using the keyword "new" in java?
The technical interview stage of a job requires a thorough preparation before you can impress the interviewer. Right from knowing everything about the technical subject to apprising the interviewers about your previous achievements and projects, you are required to do everything that can convince them about your knowledge and skills.
In this article, we have prepared a list of most frequently asked J2EE and Hibernate interview questions and answers.
1) What is J2EE?
J2EE means Java 2 Enterprise Edition. The functionality of J2EE is developing multitier web based applications .The J2EE platform is consists of a set of services, application programming interfaces (APIs), and protocols.
2) What are the four components of J2EE application?
- Application clients components.
- Servlet and JSP technology are web components.
- Business components (JavaBeans).
- Resource adapter components
3) What are types of J2EE clients?
- Applets
- Application clients
- Java Web Start-enabled clients, by Java Web Start technology.
- Wireless clients, based on MIDP technology.
4) What are considered as a web component?
Java Servlet and Java Server Pages technology components are web components. Servlets are Java programming language that dynamically receive requests and make responses. JSP pages execute as servlets but allow a more natural approach to creating static content.
5) What is JSF?
JavaServer Faces (JSF) is a user interface (UI) designing framework for Java web applications. JSF provide a set of reusable UI components, standard for web applications. JSF is based on MVC design pattern. It automatically saves the form data to server and populates the form date when display at client side.
6) Define Hash table
HashTable is just like Hash Map, Collection having key(Unique),value pairs. HashTable is a collection Synchronized object .It does not allow duplicate values but it allows null values.
7) What is Hibernate?
Hibernate is a open source object-relational mapping and query service. In hibernate we can write HQL instead of SQL which save developers to spend more time on writing the native SQL. Hibernate has more powerful association, inheritance, polymorphism, composition, and collections. It is a beautiful approach for persisting into database using the java objects. Hibernate also allows you to express queries using java-based criteria .
8 ) What is the limitation of hibernate?
Slower in executing the queries than queries are used directly. Only query language support for composite keys. No shared references to value types.
9) What are the advantage of hibernate.
- Hibernate is portable i mean database independent, Vendor independence.
- Standard ORM also supports JPA
- Mapping of Domain object to relational database.
- Hibernate is better then plain JDBC.
- JPA provider in JPA based applications.
10) What is ORM?
ORM stands for Object-Relational mapping. The objects in a Java class which is mapped in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another.
11) Difference between save and saveOrUpdate
save() - This method in hibernate is used to stores an object into the database. It insert an entry if the record doesn't exist, otherwise not. saveOrUpdate ()- This method in the hibernate is used for updating the object using identifier. If the identifier is missing this method calls save(). If the identifier exists, it will call update method.
12) Difference between load and get method?
load() can’t find the object from cache or database, an exception is thrown and the load() method never returns null. get() method returns null if the object can’t be found. The load() method may return a proxy instead of a real persistent instance get() never returns a proxy.
13) How to invoke stored procedure in hibernate?
{ ? = call thisISTheProcedure() }
14) What are the benefits of ORM?
- Productivity
- Maintainability
- Performance
- Vendor independence
15) What the Core interfaces are of hibernate framework?
- Session Interface
- SessionFactory Interface
- Configuration Interface
- Transaction Interface
- Query and Criteria Interface
16) What is the file extension used for hibernate mapping file?
The name of the file should be like this : filename.hbm.xml
17) What is the file name of hibernate configuration file?
The name of the file should be like this : hibernate.cfg.xml
18) Define connection pooling?
Connection pooling is a mechanism reuse the connection which contains the number of already created object connection. So whenever there is a necessary for object, this mechanism is used to directly get objects without creating it.
19) What is the hibernate proxy?
An object proxy is just a way to avoid retrieving an object until you need it. Hibernate 2 does not proxy objects by default.
20) What is HQL?
HQL stands for Hibernate Query Language. Hibernate allows to the user to express queries in its own portable SQL extension and this is called as HQL. It also allows the user to express in native SQL.
21) What are the Collection types in Hibernate ?
Set, List, Array, Map, Bag
22) What is a thin client?
A thin client is a program interface to the application that does not have any operations like query of databases, execute complex business rules, or connect to legacy applications.
23) Differentiate between .ear, .jar and .war files
.jar files: These files are with the .jar extension. The .jar files contains the libraries, resources and accessories files like property files. .war files: These files are with the .war extension. The .war file contains jsp, html, JavaScript and other files for necessary for the development of web applications. .ear files: The .ear file contains the EJB modules of the application.
24) What are the JSP tag?
- In JSP tags can be divided into 4 different types.
- Directives
- Declarations
- Scriplets
- Expressions
25) What are JSP Directives?
- age Directives
- include Directives:
- taglib Directives
26) What is the EAR file?
An EAR file is a JAR file with an .ear extension. A J2EE application with all of its modules is delivered in EAR file.
27) What is Struts?
Struts framework is a Model-View-Controller(MVC) architecture for designing large scale applications. Which is combines of Java Servlets, JSP, Custom tags, and message. Struts helps you to create an extensible development environment for your application, based on published standards and proven design patterns. Model in many applications represent the internal state of the system as a set of one or more JavaBeans. The View is most often constructed using JavaServer Pages (JSP) technology. The Controller is focused on receiving requests from the client and producing the next phase of the user interface to an appropriate View component. The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings.
27) What is the MVC on struts?
MVC stands for Model-View-Controller. Model : Model in many applications represent the internal state of the system as a set of one or more JavaBeans. View : The View is most often constructed using JavaServer Pages (JSP) technology. Controller : The Controller is focused on receiving requests from the client and producing the next phase of the user interface to an appropriate View component. The primary component of the Controller in the framework is a servlet of class ActionServlet. This servlet is configured by defining a set of ActionMappings.
28) What are different modules in spring?
- There are seven core modules in spring
- The Core container module
- O/R mapping module (Object/Relational)
- DAO module
- Application context module
- Aspect Oriented Programming
- Web module
- MVC module
29) What are the Benefits Spring Framework ?
- Light weight container
- Spring can effectively organize your middle tier objects
- Initialization of properties is easy.
- No need to read from properties file
- application code is much easier to unit test
- Objects are created Lazily , Singleton-configuration
- Spring's configuration management services can be used in any architectural layer in
- whatever runtime environment
30) How to Create Object without using the keyword "new" in java?
Without new the Factory methods are used to create objects for a class. For example Calendar c = Calendar.getInstance(); here Calendar is a class and the method getInstance() is a Factory method which can create object for Calendar class.
> Thanks for reading this out, All the Best