The integration of the two frameworks after using Hibernate and the spring framework becomes quite easy,Why integrate hibernate?1. Managing Sessionfactory objects with the IOC feature of springLocalsessionfactorybean2. Manage session objects with springHibernatetemplate3. Implement declarative transaction management using Spring's featuresFirst step: Build
menu. On libraries selection, spring 3.0 AOP Libraries, Spring 3.0 Core Libraries, Spring 3.0 Persistence Core Libraries, Spring 3.0 Persistence JDBC Libraries, and Spring 3.0 Web Libraries need to be added;
4. add support for Hibernate
Spring integration hibernate consists of three parts: Hibernate configuration, Hibernate core objects to spring management, transactions by AOP control benefits:
Configuration by Java code, get rid of hard-coded, connect database and other information more flexible
Previous Words struts2,hibernate,spring integrated notes (1)Then continueStart hibernate configuration after configuring strutsHibernate's environment is not dependent on the Web development environment, the first time I configured hibernate with the Javase,In window-> preferences->java->user libraries, create a new us
entity.hbm.xmlConfiguration information4, the creation of DAO layer, Service layer (basic additions and deletions for testing)PS. Description: The DAO implementation class inherits the Hibernatedaosupport and can get the session directly without the need of sessionfactory.5, the action layer in front of the configuration struts2 on the basis of the addition of business code (increase and deletion of check)There are two ways to get a userservice:Get/set WayAnnotation method6, in the Applicationc
1.Spring Integrated Hibernate(1) Introduction of the development packageA. Spring Basic package: Spring.jar,commons-logging.jarB. Spring AOP Package: Aspectjrt.jar,aspectjweaver.jar,cglib-nodep-2.1_3.jarC. Database driver package: Mysql-connector-java-5.1.6-bin.jarD. Connection Pool Package: Commons-dbcp.jar,commons-po
Struts + spring + hibernate
This configuration environment: myeclipse5.5, Mysql5.0,Struts1.2,Spring2.0,Hibernate3.1
I,Construction......
II, To use Struts , Spring , Hibernate Required packages must be imported 1 , Struts ( No difference from before )2 , Spring Import
Examples of JSF 2.0 + spring + hibernate Integration
Here, jsf2.0, spring, and hibernate will be used for integration. At the end of the article, the project will create a JSP page to display a customer object and add an Add button, save the new object entered by the user to the database. PS: the database used in this
Simply put, these three methods encapsulate some common functional methods to normalize these methods, avoiding repeated and fragmented compilation of similar code in jsp development. In other words, struts2 is responsible for processing customer requests and forwarding them to specific action methods for execution. This process uses struts2's Loopers, filters, interceptors, and other functions. The struts2 tag function is equivalent to the jsp tag. The advantage of the struts2 tag is that it us
We take the order in the project as an example to briefly describe the integration of spring and hibernate. We have introduced how to use hibernate to map database tables. Here we are concerned about how to configure spring so that it can manage hibernate. In fact, as long a
[Interview question 2] Spring, hibernate, and Struts Interview Questions (including answers)
(Statement: This is not for other commercial interests, but for study and discussion)
[Solemnly declare]: I hope you will be able to share your thoughts.How does hibernate work and why?Principle:1. Read and parse the configuration file2. Read and parse the ing informatio
Spring + Hibernate minor exception, SpringHibernate
Org. springframework. transaction. CannotCreateTransactionException: cocould not open Hibernate Session for transaction; nested exception is org. hibernate. exception. GenericJDBCException: Cannot open connectionAt org. springframework. orm. hibernate3.HibernateTransa
getwebapplicationcontext in actionsupport to obtain this applicationcontext object, which does not make me feel much benefit. The sample code is as follows:Enumeration E = application. getattributenames ();While (E. hasmoreelements ()){String attributename = (string) E. nextelement ();String objclassname = application. getattribute (attributename). getclass (). getname ();Try{Response. getwriter (). println (attributename + ":" + objclassname +"");} Catch (exception ex ){}}Studentmanager = This
It programmer development Essentials-all kinds of resources download list, history of the most IT resources, personal collection summary.
are using Subversion version control, can be viewed directly from the browser via the URL, you can also use the SVN client checkout down, carefully study the source is good ah.
=================== Struts ========================= =======
Apache Project SVN Resources
SVN Co http://svn.apache.org/repos/asf/
Struts SVN Resources
SVN Co http://svn.apache.org/r
Persondao;
@Resource
sessionfactory;
Automatically injects the class to be invoked;
With such annotations, the corresponding Bean objects are not configured in the configuration file;
1, the introduction of the corresponding jar package, Spring package: Spring-aop spring-aspect spring-context
In the combination framework model of struts + Spring + hibernate, what are the characteristics of each of the three.The MVC design pattern of Struts can make our logic clear.Spring's IOC and AOP can make our products to the maximum solution to the Lotus root.Hibernate, of course, is the persistence of entity objects.The typical three-storey Java-EE structure is divided into presentation layer, middle layer
[It168 technical documents] http://tech.it168.com/j/2007-08-02/200708022255218.shtml
This articleArticleThis is a summary after I read Xia Xin's spring guide again. I am most familiar with Struts, but I do not have much practical experience with spring and hibernate. So although this article focuses on the integration of the three, it is mainly centered on stru
SSH (STRUTS + spring + hibernate)
Their respective roles:
To put it simply:
Struts-controlled
Hibernate
Spring decoupledDetails:
Struts plays a controlling role in the SSH framework. Its core is controller, that is, actionservlet. The core of actionservlet is Struts-confi G. XML, which mainly controls the processing o
actionsupport to obtain this applicationcontext object, which does not make me feel much benefit. The sample code is as follows:Enumeration E = application. getattributenames ();While (E. hasmoreelements ()){String attributename = (string) E. nextelement ();String objclassname = application. getattribute (attributename). getclass (). getname ();Try{Response. getwriter (). println (attributename + ":" + objclassname + "} Catch (exception ex ){}}Studentmanager = This. getwebapplicationcontext ().
This article is based on the built-in STRUTS2 project integrationSpring+hibernate, if the reader is not familiar with the STRUTS2 project, please read firstImplementation steps:The first step: introduce the required jar package for spring as shown in:Second Step: Import hibernate required jar package, as in the jar file selected:Step three: Import struts-
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.