Alibabacloud.com offers a wide variety of articles about spring and hibernate integration, easily find your spring and hibernate integration information here online.
configure Current_session_context_class as thread in Hibernate.cfg.xml.Using Hibernate in spring, if we configure TransactionManager, then we should not call Sessionfactory's opensession () to get Sessioin, Because this session is not managed by the transaction.As for the solution, you can use the following methods:1. In the spring configuration file, addProgram
Just learned the integration of Hibernate and spring, and now it's time to summarize.To implement a function as an example, share the whole process with you.What you need to do: build a person class that includes name,sex,age,birthaday four properties that we want to implement to add a person object to the database through Hi
1. Join Spring1) Add Jar Package2) Configure Web. XML applicationcontext.xml (Listener)3) Add Spring Config file: AOP context TX Bean1. Join Hibernate1.1 Establish a persistence class, and its corresponding xxx,hbm. XML file, production of the corresponding data table1.2spring Integrated Hibernate1) Add Jar Package2) Add the Hibernate.cfg.xml file under Class path. Where hibernate is configured for basic co
"AddUser";} @RequestMapping ("/toupdateuser") public String toupdateuser (int id, Modelmap modelmap) {User user = Userservice.getuser ( ID); Modelmap.addattribute ("User", user); return "Edituser";} @RequestMapping ("/adduser") public String addUser (user user) {userservice.adduser (user); return "redirect:/user/ Getalluser ";} @RequestMapping ("/getalluser") public StRing GetAllUsers (Modelmap modelmap) {listHere are the code for several JSP pageslogin.jspindex.jspWhere does jquery need to be
Spring-SpringMVC-Hibernate Integration
Because maven is not used, check the package structure directly! Maven may be included later!
There are a lot of packages, but don't care about these details.
See the configuration file below
A spring-common.xml (equivalent to applicationContext. xml)
other people's solution, direct Other after all, this is not a textbook, to everyone to study, finally on this complete project, that is, my homework, serious hint: do not directly import into the run, because not to run, but to create a new project, according to the above steps, finally see what is missing and then copied into or modified, The SQL code is also in the inside, the database is called BMS. There's a problem with me qq1471914707, project: Http://pan.baidu.com/s/1hr59lkC struts2+
SSH Overview: The latest version of Struts2, Hibernate, Spring framework of a consolidation, including the latest version of the jar, Tomcat, simple testing is a general stable framework.
Second, the following is the name of the framework, the version, and the time of the last release
1, Struts2
1. Sturts2 version
Frame name
version
Last release time
Struts2
2.3.4
The flex background uses spring + hibernate. The Integration Method of spring + Hibernate is the same as that in the J2EE project. Mainly integration of flex and spring
Compile springfa
Spring+struts2+hibernate Integrated development projects in addition to our regular methods, you can also use full annotations to make development more convenient and fast.One: Introducing a jar package that supports full annotation integration relatedSecond: Build the project structure (to add students as an example)Beans Layer@Entity@Table //database table
); return "Edituser";} @RequestMapping ("/adduser") public String addUser (user user) {userservice.adduser (user); return "redirect:/user/ Getalluser ";} @RequestMapping ("/getalluser") public StRing GetAllUsers (Modelmap modelmap) {listHere are the code for several JSP pageslogin.jspindex.jspWhere does the deletion use jquery need to be referenced? jquery Packageedituser.jspadduser.jspWhere JS codeThe above basically completes the integration between
When the project was developed, the database operation was performed in a job with lazy loading, but the following errorOrg.hibernate.LazyInitializationException:failed to lazily initialize a collection of role: ..., no session or Sessio N was closedLazy loading is configured in the project using Hibernate annotations, not an XML configuration file,The following is a list of solutions collected from the Internet1, report the following errorOrg.hiberna
Web. XML opens spring Open Springmvc SPRINGMVC 1 Scan Controller Annotations 2 Spring Application-dao.xml 1. Note Scanning excludes controller Scan 2. Data source 3.sessionFactory (Datasourse,hibernateproperties,annotatedclasses annotated entity class below)Application-tx.xml 1.transctionManager (sessionfactory) 2.3.aopSPRINGMVC Spring
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
/resources/css/"Cache-period= "31556926" /> Beans>After the above configuration is complete, you can access static resources in the corresponding directory (CSS/JS/IMAGES/FTL, etc.) in the project.Four. Configuring SPRING.FTL for reading static resourcesCopy the corresponding SPRING.FTL file in the WEBMVC corresponding directory, and put it in our own project (you can also use the corresponding path without copy setting), as follows: Five. Use static resources in the FTL file, as shown in th
{@RequestMapping (value = "/login", method = requestmethod.get) public String LogiN () {System.out.println ("hello,world!");return "/index.jsp"; }}After the configuration, publish try, look for feeling.This part is relatively simple, first write so much, follow-up write integration hibernate part. There are questions can leave a message to me, because I have been integrated, this is the side of the code to
The functionality of Struts 2 and Spring is coincident, so it is necessary to illustrate which technologies in the two frameworks are used in the integration.Struts 2 uses function points:1, interceptors. One is to intercept non-logged-in users ' purchases, and one is to intercept the file upload format. The former interceptor files need to be written manually, which can be directly encapsulated with the Struts 2 framework of the Interceptor.2, data c
These three are all well-known frameworks for Java (SSH)STRUTS2, as a controller, is the equivalent of a servlet that uses an interceptor mechanism to process a user's request.Hibernate, persistence framework.Spring,java Layered Lightweight framework. Used to manage, provide dependency injection, facets, etc.If there is any mistake, please correct me.SSH Framework IntegrationIn the first instance of the Web. XML configuration, one of the highlights of hibern
I. Building STRUTS21). Import the Struts2 jar package2). Writing Web. xml3). Writing JSP pages4). To create an action class, the action class inherits the Actionsupport class5). Create Struts.xml two. Build Spring1). Import the Spring jar package and import a struts2 provided plug-in package2). Create a Applicationcontext.xml fileModify Struts.xml3). Configure spring monitoring in Web. xmlThree. Setting up
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.