In the sessionfactory configuration file of SSH2
Set hibernate. current_session_context_class to org. springframework. Orm. hibernate3.springsessioncontext (default value)
And apply spring to manage transactions.
If it is
In the source code of spring class localsessionfactorybean
In method buildsessionfactory
If
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
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
In the java Enterprise application field, the powerful functions of ejbs are the same as the complicated configurations of ejbs, and they are also known for their difficulties in learning. But before, what can we do? You can only learn ejbs with a hard head. It is a bit of "understanding that there are tigers in the mountains and moving towards tigers. There has been an optimistic change in the form. The popularity of java open source has made the development of java Enterprise applications no l
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
This article is a primer for developing Web applications based on spring, using the Struts MVC framework, the middle tier using spring, and the background using hibernate.
This article contains the following elements:
• Configure Hibernate and transactions
• Load Spring's applicationcontext.xml file
• Establish dep
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
A recent study of spring has a little understanding of AOP,IOC. First, I send a consolidated code
1, use the IDE is NetBeans, personally feel what tools are the same.
2, Code structure view
3, the various classes of code, first from the DAO, Iuserdao and Userdaoimpl This needless to say, is the persistence layer of code. Use spring to manage hibernate. First you
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
1, SSH three framework integration principle
The integration of spring and Struts2 is to give the Action object to the Spring container for creation.
The integration of spring and Hibernate is to give the sessionfactory to the spring container for maintenance, a
[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
Flex + J2EE instance (cairngorm + blazeds + hibernate + spring) Part3---- Add Spring hibernate
1. Add spring, Hibernate common jar under WEB-INF \ Lib, including MySQL database connection driver
2. Create a database in the MySQ
First, create the Hibernate entity mapping file.Create a mapping file Product.hbm.xml in the package where the entity is located, introducing Hibernate's mapping constraints. (the constraint is located inside the Hibernate3.jar hibernate-mapping-3.0.dtd, can be cope used) such as:Product.hbm.xml:Second, using spring to introduce a property file to connect to the
Struts+spring+hibernate The combination of three is perfect
The key to consolidating the three is the configuration file
1.web.xml for Web server mount filters, servlet, and configuration files
Struts This is loaded Org.apache.struts.action.ActionServlet, and its configuration parameter config file struts-config.xml,spring is loaded here Org.springframework.web.c
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-
It's been a long time since I used the spring framework, and it's been struts2+hibernate4 to build Web projects, and lately, to learn something about spring, spring is the most widely used framework now, and will work in this industry, so it's necessary to learn.The spring framework is added first and can be run correc
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.