Over the past few days, I have made Hibernate and spring look good. I think about some of struts's things and decided to integrate the three things. The presentation layer uses STRUTS + freemarker and the business layer uses spring, hibernate processes the persistent layer. In struts, authorization is used to delegate
level Cach E provider, Hibernate-infinispan, for example, are available in the classpath).The Hibernate.cfg.xml configuration needs to be added:Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' sessionfactory ' defined in Class path resource [Resource/applicationcontext.xml]: Invocation of Init method failed; Nested exception is Java.lang.noclassdeffounderror:org/slf4j/loggerfactoryLack of Slf4j-api-1.6.1.jarOrg.
Spring integrated Hibernate spring supports most popular ORM frameworks, including Hibernate JDO, TopLink, Ibatis, and JPA. •Spring's support for these ORM frameworks is consistent, and hibernate integration technology can be applied to other ORM frameworks.
Basic integration of Spring integrated Hibernate3Spring integration Hibernate3 and 4 have a certain difference, the basic is currently using 3, so here the content is based on 3;1. Import hibernate packages and Spring packages1.1. Import a Spring dependency package1.2. Import the log4j dependency package: Log4j-1.2.16.
toString method to output information.
}
}
Then
Add bean-related configuration in the configuration file AppliccationContext. xml (this is a value injection, interface and construction injection)
Test code
Public class testPerson {Public static void main (String [] args ){XmlBeanFactory beansfactory = new XmlBeanFactory (new FileSystemResource ("src/ApplicationContext. xml "));System. out. println (beansfactory );Person nike = (Person) beansfactory. getBean ("nike ");System. out. println (
directory for Lucene (you can give the absolute path, because I am a Linux system, so there is no drive letter), of course, only valid for hibernate, if you skip hibernate direct operationsLucene, this directory is useless
Configuration in Spring:People familiar with spring + hibernate should be familiar with this con
Over the past few days, I have made Hibernate and spring look good. I think about some of struts's things and decided to integrate the three things. The presentation layer uses STRUTS + freemarker and the business layer uses spring, hibernate processes the persistent layer. In struts, authorization is used to delegate
Spring + springmvc + hibernate integrated instance, springmvchib.pdf
In the previous blog, I wrote about the integration of spring and springmvc, and added hibernate to this article.
Like the previous one, this time is still a pilot jar package. This time, you need to add the jar package in
ObjectiveSSH is not a framework, but an integration of multiple frameworks (Struts+spring+hibernate), and is now a popular open-source integration framework for Web applications to build flexible, easy-to-scale, multi-tiered Web applications.The systems that integrate the SSH framework are divided into four tiers: presentation layer, business logic layer, data persistence layer, and Domain module layer (ent
It's actually very simple.
The first method is to use hiberante. cfg. xml:
The configuration of hiberante. cfg. XML is as follows:
"-// Hibernate/hibernate configuration DTD 3.0 // en"Http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">Org. hibernate. dialect. mysqldialectThen configure applicationContext
SPRINGMVC:The Spring framework is highly configurable and includes a variety of view technologies, such as JavaServer Pages (JSP) technology, Velocity, Tiles, IText, and POI. The Spring MVC framework does not know which view to use, so you can choose the view autonomously. Spring MVC separates the roles of controllers, model objects, dispatchers, and handler obje
struts+hibernate+spring Implement User Login functionThrough the login case to achieve the integration between the three frameworks, the login function is a necessary module for any system and software, but through this module to understand these complex framework technology, understanding the data flow and the whole design idea is quite easy. Only after mastering the application of these small modules, it
Struts, Hibernate, and spring are common keys in our Java development, and they provide the most appropriate solution for different scenarios. But do you know how these well-known frameworks were originally created?We know that traditional Java Web applications are implemented using Jsp+servlet+javabean, which implements the most basic MVC layering, which divides the program structure into several layers, t
Spring provides great support for Hibernate integration. Spring provides initialization for sessionfactory, So you no longer need to worry about session open and close. Spring also provides flexible transaction declarations.
This article describes how to integrate Hibernate
Document directory
How does hibernate work and why?
How does hibernate delay loading?
In hibernate, how does one implement the relationship between classes? (For example, one-to-many and many-to-many relationships)
Let's talk about the cache mechanism of hibernate.
Hibernate
The key to spring and hibernate integration is that Hibernate's sessionfactory is created by the spring IOC container, and Hibernate's transactions are managed by spring's AOP. Note: Because of the integration, the configuration in Hibernate configuration file (Hibernate.cfg.xml) can be written to the
This article belongs to reprint, from Baidu question Http://zhidao.baidu.com/question/213823575.html?qbl=relate_question_0word=beans%20publicSsh:Struts (presentation layer) +spring (business layer) +hibernate (persistence layer)Struts:Struts is a presentation-layer framework that mainly functions as interface display, receiving requests, and distributing requests.In the MVC framework, struts belongs to the
Struts: Responsible for the display layer, is a perfect MVC implementation, it calls the business layer to complete the operational logic, the business layer calls the persistence layer to complete the database read and write.Hibernate: Creates a series of persisted classes that correspond to the properties of each class to the database table's property one by one.Spring: relies on injection and control inversion. As soon as you get a class that implements this interface, you can easily inject t
Learn extjs5 with me (27 -- adding the Server web, spring, and hibernate configuration files ),Learn extjs5 with me (27 -- adding the Server web, spring, and hibernate configuration files)
We created a java web project before. Now we need to add the jar packages connected by spr
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
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.