Spring+struts2+hibernate Integration

Source: Internet
Author: User
Tags aop log4j
This article describes
Integration of 1.struts2+spring2.5+hibernate3.3
2. Using Unit Tests
3. Added the operation configuration of LOB type
4. Introduction Oralce Drive This article uses oracle11g
5. Set the mapping relationship in hibernate with "enumeration"


Download of jar:
struts2:http://struts.apache.org/download.cgi#struts2013
hibernate:http://www.hibernate.org/Click Hibernate Core Download
Spring:http://www.springsource.org/download

Introduction to Oracle Drivers

Java code Class12.jar (JDK 1.2/1.3) Class14.jar (JDK 1.4/1.5) in fact, as long as the installation of Oracle will not download the driver package, in the installation program has D:\app\Admin\product\ 11.1.0\db_1\jdbc\lib This directory to select the corresponding driver package according to the JDK used. (Example: Ojdbc6.jar)


SSH2 Integration of required jars
1.Strusts
Java code javassist-3.4.ga.jar commons-fileupload-1.2.1.jar Commons-logging-1.0.4.jar Freemarker-2.3.15.jar ognl-2. 7.3.jar Struts2-core-2.1.8.jar Xwork-core-2.1.6.jar Struts2-spring-plugin-2.1.8.jar

2.Hibernate
Java code commons-collections-3.1.jar dom4j-1.6.1.jar Ehcache-1.2.3.jar Ejb3-persistence.jar hibernate-annotations. Jar Hibernate-cglib-repack-2.1_3.jar Hibernate-commons-annotations.jar Hibernate-entitymanager.jar//In order to use the mappings of enum types this Bag Hibernate3.jar javassist-3.4.ga.jar jta-1.1.jar log4j.jar Slf4j-api-1.5.2.jar Slf4j-log4j12.jar

3.Spring
Java code aspectjrt.jar aspectjweaver.jar C3p0-0.9.1.2.jar Cglib-nodep-2.1_3.jar Common-annotations.jar log4j-1.2 .15.jar Spring.jar

Integration steps first integration spring2.5+hibernate3.3 success in the integration of Struts2 so it is not easy to report errors, but also easy to identify problems after the error.

Spring profile templates can be copied to some of the examples that spring comes with.

Applicationcontext.xml
XML code    <?xml version= "1.0"  encoding= "UTF-8"?>   <?xml version= "1.0"  encoding= "UTF-8"?>   <beans xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"         xmlns= "Http://www.springframework.org/schema/beans"        xmlns:context= "Http://www.springframework.org/schema/context"         xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"        xmlns:tx= "Http://www.springframework.org/schema/tx"        xsi:schemalocation= "http// www.springframework.org/schema/beans       http://www.springframework.org/schema/ beans/spring-beans-2.5.xsd       http://www.springframework.org/schema/context        http://www.springframework.org/schema/context/spring-context-2.5.xsd    &NBSP;&Nbsp;  http://www.springframework.org/schema/aop       http:// www.springframework.org/schema/aop/spring-aop-2.5.xsd       http:// www.springframework.org/schema/tx       http://www.springframework.org/schema/tx/ Spring-tx-2.5.xsd ">      <!--  Using scanning  +  annotations to develop   can improve development efficiency, and later maintenance becomes difficult, Poor readability  -->   <context:component-scan base-package= "com.sh"/>       <!--  using C3P0 data sources   This is a much more data source used in the Enterprise  -->   <!-- destroy-method= "close "is used to re-place the connection into the data pool when the database connection is not in use, facilitating the next use of the call  -->   <bean id=" DataSource " class=" Com.mchange.v2.c3p0.ComboPooledDataSource " destroy-method=" Close ">      < Property name= "Driverclass"  value= "Oracle.jdbc.driver.OracleDriver"/>       <property name= "JdbcurL " value=" JDBC:ORACLE:THIN:@127.0.0.1:1521:ORCL "/>      <property name = "User"  value= "luob"/>      <property name=

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.