Java Interview Questions and Answers Set 6

 51. What are the advantages of hibernate?

  • Hibernate is portable i mean database independent, Vendor independence.
  • Standard ORM also supports JPA
  • Mapping of the Domain object to the relational database.
  • Hibernate is better than plain JDBC.
  • JPA provider in JPA based applications.

 52.Define connection pooling?

Connection pooling is a mechanism reuse the connection.which contains the number of already created object connection. So whenever it is  necessary for an object, this mechanism is used to directly get objects without creating it.

53.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

Calender c=Calender.getInstance();

here Calender is a class and the method getInstance() is a Factory method which can create an object for Calendar class.

54.What is Spring?

Spring is a light weight open source framework for the development of enterprise application that resolves the complexity of enterprise application development also providing a cohesive framework for J2EE application development. Which is primarily based on IOC (inversion of control) or DI (dependency injection) design pattern.

55.What is action mapping??

In action mapping, we specify action class for particular URL ie path and different target view ie forwards on to which request response will be forwarded.The ActionMapping represents the information that the ActionServlet knows about the mapping of a particular request to an instance of a particular Action class.The mapping is passed to the execute() method of the Action class, enabling access to this information directly.

Weekend / Weekday Batch

56. What is the MVC on struts?

MVC stands 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.

57.Is that Servlet is pure java object or not?

Yes, Servlet is pure java object.

58.What is called JSP directive?

JSP directive is the mechanism to provide Metadata information to web container about JSP file. In the translation and compilation phases of the JSP life cycle, these Metadata use by the web container.

59.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 a 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

60.How to disable caching on back button of the browser?




response.setHeader (“Expires”, “0”);                    //prevents caching at the proxy server