Spring2.0 + hibernate3.1 + log4j + mysql demo

2009-02-27  来源:本站原创  分类:Java  人气:2138 

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	     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.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

<!--  Start reading the configuration file -->
	<bean>
		<property name="locations">
			<list>
				<value>/WEB-INF/config/jdbc.properties</value>
			</list>
		</property>
	</bean>
<!-- Read the end -->

<!-- HibernateConfiguration -->
	<bean
		class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" ><value>${jdbc.driverClassName}</value> </property>
		<property name="url" ><value>${jdbc.url}</value> </property>
		<property name="username" ><value>${jdbc.username}</value></property>
		<property name="password" ><value>${jdbc.password}</value></property>
	</bean>
	<bean
       >
      <property name="dataSource">
            <ref bean="dataSource" />
       </property>
   		<property name="configLocation"><value>/WEB-INF/hibernate/hibernate.cfg.xml</value></property>
    </bean>
<!-- HibernateConfigure end -->

<!-- Begin transaction -->
 	<bean>
	  <property name="sessionFactory">
	  	 <ref local="sessionFactory" />
	  </property>
 	</bean>

 <tx:advice transaction-manager="transactionManager">
  <!-- the transactional semantics... -->
  <tx:attributes>
   <!-- all methods starting with 'get' or 'find' are read-only -->
   <tx:method name="get*" read-only="true" />
   <tx:method name="find*" read-only="true" />
   <!-- all methods starting with 'update' or 'insert' or 'delete' will use the default transaction settings (see below) -->
   <tx:method name="update*" />
   <tx:method name="insert*" />
   <tx:method name="save*" />
   <tx:method name="delete*" />
  </tx:attributes>
 </tx:advice>

 	<aop:config>
    	<aop:pointcut expression="execution(* demo.service.*.*(..))"/>
    	<aop:advisor advice-ref="txAdvice" pointcut-ref="fooServiceOperation"/>
  	</aop:config>
<!-- At the end of the transaction -->

<!-- bean Injection started -->
	<bean>
		<property name="sessionFactory">
			<ref bean="sessionFactory" />
		</property>
	</bean>

	<bean>
		<property name="userDao" ref="UserDAO"></property>
	</bean>

<!-- bean Injection end -->

</beans>

Non-attachment jar package, necessary friends can send an email to todd.liangt @ gmail.com

相关文章
  • Spring2.0 + hibernate3.1 + log4j + mysql demo 2009-02-27

    applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.spri

  • SF1.2 + Spring2.0 + Hibernate3.2 2009-05-08

    Hanjing JAVA language JAVA study blog <<Java tutorial spring as the implementation gmail outgoing mail server-java source code | Home | TCP multiplayer chat applet>> Sep 20, 2008 JSF1.2 + Spring2.0 + Hibernate3.2 At the recent preparation of a

  • struts2.1.6 + spring2.0 + hibernate3.2 be easily configured to 2010-03-19

    Recent study ssh2 integration of programming, by the way here, what next struts2 news updates, download a new version of the 2.1.8.1 version of struts2, using MyEclipse8.0 development, but the problem came along. MyEclipse8.0 in the built-in struts2

  • struts2.0 + spring2.0 + hibernate3.1 complete process integration of multi-layer model of common errors (change) 2010-04-16

    Looking for entry-level, but the error solution for your reference. In this use MyEclipse6.0 as a programming environment, and truly comprehend after ssh, you know MyEclipse add spring and hibernate Support intention is automatically added to MyEclip

  • struts2.0 + spring2.0 + hibernate3.1 whole process of integration of multi-layer model of common errors (transfer) 2010-11-11

    Look for entry-level, but the bug is fixed for your reference. As used here MyEclipse6.0 programming environment, the real insight ssh, the will know to add spring and hibernate support for MyEclipse was intended only to spring and hibernate MyEclips

  • spring 2.0 + hibernate3.2 + struts 2.0 configuration records 2009-11-16

    struts2.0 + spring2.0 + hibernate 3.2 combined with the development of Web applications has brought a lot of improvements, more configuration parameters. The following describes how to combine the use of development projects struts2.0 + spring2.0 + h

  • struts2.0 spring2.5 hibernate3.3 Integration 2009-04-04

    struts2.0 spring2.5 hibernate3.3 integration of an integrating jar package first download the framework of three struts2.0 Download http://apache.freelamp.com/struts/binaries/struts-2.0.14-all.zip spring2.5 Download http://s3.amazonaws.com/dist.sprin

  • struts2 + hibernate3.2 + spring2.0 instance configuration + Getting Started 2010-04-13

    eclipse3.2, myeclipse5.0, Jboss4.0.3, sql server2000 sp3 Principle of In the java enterprise applications, ejb powerful ejb configuration with the complex and difficult to learn as well known. But in the past and what we do? Just bite the bullet and

  • Based Annotation of Struts2.0 + Hibernate3.3 + Spring2.5 Integrated Development (turn) 2008-08-19

    Annotation-based access to our in Struts2.0 + Hibernate3.3 + Spring2.5 integrated development of the final stage, this phase of our project is mainly the introduction of Struts2's Annotation. Relative to the Hibernate with Annotation and Annotation o

  • struts2 + spring2.5 + hibernate3.2 + MySQL5 fully integrated 2010-04-13

    struts2 + spring2.5 + hibernate3.2 + MySQL5.1 Learning is still school tutorials, according to their own understanding, through a simple user login detection framework for the implementation to complete the three kinds of structures, all documents an

  • Struts2 Spring2.5 hibernate3.3 the whole process of integrated development environment to build 2011-05-19

    Struts2 Spring2.5 hibernate3.3 the whole process of integrated development environment to build Recently, we developed the framework to be used s2sh B2C model e-commerce system, first we need to build the framework needed for the three major developm

  • Spring2.0 compressed package directory Description 2010-04-13

    1, Spring2.0 compressed package directory Description aspectj directory in the Spring framework to use aspectj source code and test program files. Aspectj is the first java application framework for the provision of AOP. dist directory is a Spring re

  • Spring2.0 jar package 2010-04-24

    1, Spring2.0 compressed package directory Description aspectj directory in the Spring framework to use aspectj source code and test program files. Aspectj is the first java application framework for the provision of AOP. dist directory is a Spring re

  • Struts1.2 + Spring2.5 + Hibernate3.2 framework of the structure (1) 2010-03-26

    Directory 1. To prepare ... 2 1.1. Create Project ... 2 1.2. In the project to build packages ... 3 2. Struts part of the ... 3 2.1. Add Struts capabilities to support ... 3 2.2. To create ActionForm class. 5 2.3. Creating Action Class ... 6 2.4. Cre

  • Spring2.0 archive catalog description 2010-08-21

    1, Spring2.0 compressed catalog description aspectj directory in the Spring framework to use aspectj source code and test program files. Aspectj is the first to provide AOP java application framework. dist directory is a Spring release package, detai

  • s1sh integration instance Strut1.2 + Spring2.6 + Hibernate3.2 2011-04-17

    Development environment :MyEclipse8.5+Mysql Help : This example is a simple registration process ( Only two properties ) Database script :user.sql CREATE TABLE `user` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) DEFAULT NULL, `pass

  • Struts2.1.6 + Spring2.5 + Hibernate3.2 (Reprinted) 2010-03-31

    The main technology used SSH: Struts2.1.6 + Spring2.5 + Hibernate3.2 DB: Oracle10g Service: Tomcat6.0 JDK: jdk1.6 Will be in the development process problems and solutions share the hope that the joint research can progress: First, under the MyEclips

  • spring2.0 configuration of the new labeling applications 2010-07-09

    spring2.0 configuration of a new label application 2007-12-28 16:131, <util:constant/> Replaced before the acquisition by FieldRetrevingFactoryBean bean static constant FactoryBean! The use of old <bean> <property name="isolation"

  • struts2 + spring2.5 + hibernate3 + Extjs3 simple personnel management to achieve 2010-10-20

    struts2 + spring2.5 + hibernate3 + Extjs3 simple personnel management to achieve I am a beginner Extjs, many do not really understand, when you are doing with this small example, then be able to run up, but remove the modifications in the data will a

  • Spring2.0 comment implement the transaction management 2008-10-17

    Spring2.0 framework of the transaction there are two main categories: A coded transaction, it did not say. 2 Declarative transaction, say this. Declarative transaction there are three kinds of implementation methods: 1 (a) the first method, Transacti