Struts, Spring, Hibernate face Question Summary

2010-03-24  来源:本站原创  分类:Java  人气:384 

Struts, Spring, Hibernate surface examination questions summarized Keywords: struts spring hibernate interview reproduced Address: only collection

Hibernate works and why to use?


1. Read and parse the configuration file
2. Read and parse mapping information, create a SessionFactory
3. Open Sesssion
4. Creating Service Transation
5. Persistence operations
6. To commit the transaction
7. Close Session
8. SesstionFactory Close

Why use:

* To access the database JDBC code that made package greatly simplifies the tedious repetitive data access layer code.
* Hibernate is a JDBC-based persistence framework for the mainstream, is an excellent ORM implementation. He was a high degree of simplification of the coding DAO layer
* Hibernate using the Java reflection mechanism, rather than the byte-code enhancement procedures to achieve transparency.
* Hibernate performance is very good, because it is a lightweight frame. The flexibility of mapping is very good. It supports a variety of relational database, from a variety of one-to-many complex relationships.

Hibernate is how lazy?

* Hibernate2 lazy to achieve: a) physical objects b) Collection (Collection)
* Hibernate3 provides the property lazy loading function of

When the Hibernate query the data when the data does not exist with the memory, when the program actually in operation on the data, the object until the existence and memory, on the realization of a deferred load, he saved the server's memory overhead, thus improving server performance.
Hibernate classes in how to achieve the relationship between? (Such as:-to-many, many to many relationship)
The relationship between class and class is mainly reflected in the relationship between the table and the table to operate, they operate urban object, we process all the forms and classes are mapped together, they are through the configuration file in the many-to -one, one-to-many, many-to-many,

Referring to the next Hibernate's caching mechanism

* Existence of the internal cache in Hibernate is also called a cache belonging to application-level caching things
* 2 cache:

a) Application and Cache

b) Distributed Cache

Conditions: the data will not be a third party changes, the data size within an acceptable range, the data update frequency is low, the same data frequently used by the system, non-critical data

c) the realization of third-party cache
Hibernate query mode
Sql, Criteria, object comptosition

* Property Search
* Parameter query, named parameter query
* Associated with inquiries
* Paging Query
* Statistical Functions

How to Optimize Hibernate?

* Use two-way-to-many association, do not use one-way-to-many
* A flexible one-way-to-many association
* No-one, with many-to-replace
* Configuration object cache, the cache does not use a collection of
* One to many collections using the Bag, many to many collections using the Set
* Derived class using explicit polymorphism
* Table field is less, the table Do not be afraid associated with more than a second-level cache backing

Struts working mechanism? Why should I use Struts?
Working Mechanism:
Struts work flow:
In the web application will be loaded at startup to initialize ActionServlet, ActionServlet from the struts-config.xml file to read configuration information, store them to a variety of configuration object when the ActionServlet receives a client request, will perform the following process.
(1) to retrieve and match the user request ActionMapping instance, if you do not exist, it returns the request path is invalid information;
(2) If the ActionForm instance does not exist, it creates an ActionForm object, save the form data submitted by customers to the ActionForm object;
(3) According to the configuration information to decide whether the need Forms Authentication. If you need to verify, they call the ActionForm's validate () method;
(4) If the ActionForm's validate () method returns null or return an object that does not contain ActionMessage the ActuibErrors, it's a form validation successful;
(5) ActionServlet under ActionMapping mapping information contained in the decision which forwards the request to the Action, the Action, if the corresponding instance does not exist, create the first instance and then call the Action's execute () method;
(6) Action's execute () method returns an ActionForward object, ActionServlet in the client request transmitted to the ActionForward object pointing to the JSP components;
(7) ActionForward object point to JSP component to generate dynamic web pages, returned to the customer;

Why use:
JSP, Servlet, JavaBean technology appears to us to build powerful enterprise applications systems possible. However, systems built using these technologies is very fan a mess, on top of this, we need a rule, a technical organization up these rules, this is the framework, Struts thus arose.

Struts-based applications developed by the Category 3 components: controller, components, model components, views components
Struts framework is how to validate authentication?
In the struts configuration file to configure the specific error, and then in the FormBean the validate () method of a specific call.

Referring to the next Struts design patterns
MVC pattern: web application will be loaded at startup and initialization ActionServler. When the user submits the form, a configured ActionForm object is created, and was fill in a form corresponding data, ActionServler under the Struts-config.xml file configuration settings determine the need for good form validation, if you need to call the ActionForm's Validate () validated the option to send the request to which Action, if the Action does not exist, ActionServlet will first create the object, then calls the Action's execute () method. Execute () to get data from the ActionForm object to complete the business logic to return an ActionForward object, ActionServlet then forwarded to the client request ActionForward object specified by jsp component, ActionForward object specified by jsp generate dynamic web pages, returned to the client.


Factory (factory mode):

Define a base class === "Achieving the base class methods (sub-class, through different means )===" definition of a factory class (generated sub-class instance)

=== "Developers call the base class method

Proxy (proxy mode)

spring working mechanism and why to use?
1.spring mvc invited all of the requests are submitted to the DispatcherServlet, it will delegate the application system is responsible for other modules responsible for processing requests for real.
2.DispatcherServlet query one or more of the HandlerMapping, find the handle requests Controller.
3.DispatcherServlet requested to submit the request to the target Controller
4.Controller conduct business logic processing, it will return a ModelAndView
5.Dispathcher query one or more of the ViewResolver view resolver, find the ModelAndView object view of the specified object
6. The view object is responsible for rendering returned to the client.

Why use:
AOP allows developers to create non-behavioral concerns, called crosscutting concerns, and insert them into the application code. After the use of AOP, the public services (such as logging, persistence, transactions, etc.) can be broken down into aspects and applied to domain objects, domain object at the same time does not increase the complexity of the object model.

IOC allowed to create an application environment objects can be constructed, and then to pass these objects to their collaborators. As the word inversion indicated, IOC like the turn of the JNDI. Do not use a bunch of abstract factories, service locators, single element (singleton) and direct construction (straight construction), each object is constructed with its collaborators. Collaboration is therefore an object from the container-managed (collaborator).

Spring Even if an AOP framework, but also an IOC container. Spring the best place is that it will help you replace the object. With the Spring, as long as the use JavaBean properties and configuration files by adding dependencies (collaborative object). Can then be easily replaced when needed collaboration with a similar interface to an object.

  • Struts, Spring, Hibernate face Question Summary 2010-03-24

    Struts, Spring, Hibernate surface examination questions summarized Keywords: struts spring hibernate interview reproduced Address: only collection Hibernate works and why to use? Principl

  • Struts, Spring, Hibernate face questions Summary 2010-05-29

    Struts, Spring, Hibernate face questions Summary 1, Action is not thread safe? If not, what approach can guarantee the thread safety of Action? If yes, explain. Not declare local variables, or the expansion of RequestProcessor, so each time to create

  • struts + spring + hibernate summary 2009-05-25

    struts + spring + hibernate summary 1. Myeclipse in order to load struts, spring, hibernate 2. Add filter Add WEN-INF/web.xml <filter> <filter-name> encodingfilter </ filter-name> <filter-class> com.yourcompany.EncodingFilter </

  • MVC layer model (struts + spring + hibernate) Summary 2010-04-30

    1 SSH in the development of the position J2EE framework is now more than a few open source is not clear, the current (already being) a common framework for popular about struts, spring, hibernate, jsf, webwork, the struts + spring + hibernate (SSH) T

  • Struts, Spring, Hibernate advantages and disadvantages 2009-05-07

    Struts, Spring, Hibernate advantages and disadvantages Struts with Tomcat, Turbine, and many other Apache projects, are open-source software, which is its one great advantage. Allow developers to more in-depth understanding of its internal mechanisms

  • The use of struts + spring + hibernate assembly web application 2009-11-16

    This article will discuss how the combination of several well-known framework to achieve the purpose of loosely coupled and how to set up your framework, how to make your line all the application layer. Challenging are: combination of these framework

  • Using struts + spring + hibernate web application assembly 2010-04-01

    This article will discuss how the combination of several well-known framework to achieve the purpose of loose coupling, how to build your framework, how to make you be consistent in all the application layer. Challenging is: the combination of these

  • Struts + Spring + Hibernate processing Lob (Blob, Clob) 2010-12-09

    Struts + Spring + Hibernate processing Lob (Blob, Clob) Using struts + spring + hibernate in the development, sometimes the user will need the database files stored in the database normally used Blob Clob field or fields to store the binary image, st

  • Struts, Spring, Hibernate Web application development 1 2009-05-11

    This article is taken from: This Web application is very simple implementation of a user registration page, when users register at register.jsp enter information page, point to preserve

  • struts, spring, hibernate, convent plugin 2010-03-25

    Integrate struts, spring, hibernate, the biggest trouble for beginners on their cumbersome xml configuration file. Now all of which are annotation-based configuration provides a good support for . The struts2, the use of convent plugin, thanks to ann

  • struts.spring.hibernate integration steps 2010-05-11

    SSH integration process? struts, spring, hibernate integration steps: 1. Importing struts, spring, hibernate package necessary 2. In the web.xml to configure <context-param> <param-name> contextConfigLocation </ param-name> <param-val

  • Struts Spring Hibernate lex EXT-GWT SqlServer MySql Oracle 2010-06-20

    My blog has been transferred to Struts Spring Hibernate lex EXT-GWT SqlServer MySql Oracle

  • struts spring hibernate I see advantages and disadvantages of the (Comprehensive paste non-original) 2010-07-22

    Struts spring hibernate more "spread", and outside many companies are often asked about the SSH always advantages and disadvantages of the interview, the network also has many advantages and disadvantages of some article summing up ssh, but I fe

  • MyEclipse development of SSH (Struts + Spring + Hibernate) started [with map] 2010-08-04

    MyEclipse development of SSH (Struts + Spring + Hibernate) Getting Started March 6, 2008 at 11:24 (This reference from oksonic the " Struts + Spring + Hibernate practice (full) ") Source Download:

  • Struts + Spring + Hibernate development to join the real kung fu 2010-06-12

    The context of occupational demand. Book in-depth analysis of the current language of the mainstream Java development skills needs, and as the premise for the book content organization. * For application development into the behavior of target. This

  • Struts.Spring.Hibernate (SSH) integration examples 2009-04-09

    Web.xml is the first choice to create the ActionServlet and Struts configuration Spring characters filter <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="" xmlns:xsi="http:/

  • Struts Spring Hibernate (SSH) integration example 2009-08-12 Web.xml is the first choice to create the ActionServlet and Struts configuration Spring filter characters <? xml version = "1.0" encoding = "UTF-8"?> <web-app xmlns

  • Struts + Spring + Hibernate's technology 2010-06-28

    1, 3 About the framework Struts: Struts is Java Web MVC framework undisputed king. After more than five years of development, Struts has gradually grown into a stable, mature framework, and the possession of the MVC framework for the largest market s

  • Struts + Spring + Hibernate environment set up 2010-10-05

    First, the automatic loading Struts Create a new WebProject project, right-click the project name -> MyEclipse-> Add Struts Capabilities Select the version of Struts and fill "Base package for new classes" For example, "Struts1.2"

  • Struts / Spring / Hibernate wiki translation in English 2011-01-08

    see Apache Struts From Wikipedia, the free encyclopedia Apache Struts is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourag