Saving Spring and Hibernate data
I will not talk about the advantages of Spring MVC. It is more comfortable to use Spring MVC than Struts2. As for the persistence layer, it is more inclined to use Hibernate, so I started to try to use Sp
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
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
[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-
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
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
The following is an introduction to the integration of hibernate with spring, where the integration of the two frameworks depends on the configuration of the Applicationcontext.xml file, which is very simple, but it should be noted that importing the package must be imported to webroot/web-inf/ Lib directory, and hibernate is typically imported before
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
feel the same, the university is the basis of the study, has always felt no use, until the graduate program to do the tutor's time to find out: the original learning things so useful. While it's important to drive a project, don't shift your focus.Center of Gravity: The foundation is the most important. The foundation is firm enough to grow beautiful flowers on the basis.Read and write code. Write code, read a book. This is a shortcut.I write a CMS,
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
Hibernate provides its own transaction management implementation. However, when using spring to integrate hibernate, we recommend that you hand over the transaction to spring for programmatic transaction management.
1. User. Java
Package cn.com. Boyang;
Public class user {Private integer ID;Private string name;Private
Spring, hibernate, struts interview questions, hibernatestruts
1. Is Action thread-safe? If there is no way to ensure the thread security of Action? If yes, explain the reasonNoDeclare local variables, or expand RequestProcessor to create an Action each time, or use scope = "prototype" in spring to manage
2. MVC: analyze how struts implements MVC.M: JavaBean or c
, the 2nd is the use of interceptorsSpring+hibernate, if the set map uses lazy= "true", when the PO is passed to the view layer, an uninitialized session is closed, and only the DAO is initialized firstParent.getchilds (). Size ();Spring provides open Session in view to solve this problem, there are two ways1. Interceptorclass= "Org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor" >.....
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
Spring MVC uses the features that Hibernate validator Framework can implement:1. Annotate Java Bean Declaration validation rules.2. Add a message error message source for internationalization configuration.3. Display the error message with the errors tag in spring form.Advantage:The code is concise.Realize:1. Use Hibernate
Why does spring integrate hibernate:1. General resource management.2. Excellent Management Mechanism (sessionfactory Management Mechanism Based on dependency injection ).3. Unified transaction management.4. Unified Exception Handling
Spring integrates hibernate:1. Configure the Data source:Spring has built-in implement
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.