[jboss-cvs] jboss-seam/examples/spring/resources ...

Michael Youngstrom youngm at gmail.com
Mon Jul 9 19:10:53 EDT 2007


  User: myoungstrom
  Date: 07/07/09 19:10:53

  Modified:    examples/spring/resources    persistence.xml
                        applicationContext.xml components.xml
  Log:
  JBSEAM-992
  
  Revision  Changes    Path
  1.2       +2 -4      jboss-seam/examples/spring/resources/persistence.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: persistence.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/spring/resources/persistence.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- persistence.xml	3 Jul 2007 20:37:38 -0000	1.1
  +++ persistence.xml	9 Jul 2007 23:10:53 -0000	1.2
  @@ -8,14 +8,12 @@
           <properties>
               <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
               <property name="hibernate.show_sql" value="true"/>
  -			<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
  -			<property name="hibernate.show_sql" value="true"/>
   			<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
  -			<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
  +			<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/><!--
   			<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
   			<property name="hibernate.connection.username" value="sa"/>
   			<property name="hibernate.connection.password" value=""/>
   			<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:defaultDB"/>
  -        </properties>
  +        --></properties>
       </persistence-unit>
   </persistence>
  
  
  
  1.10      +24 -34    jboss-seam/examples/spring/resources/applicationContext.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: applicationContext.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/spring/resources/applicationContext.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- applicationContext.xml	3 Jul 2007 20:37:38 -0000	1.9
  +++ applicationContext.xml	9 Jul 2007 23:10:53 -0000	1.10
  @@ -10,9 +10,6 @@
                              http://jboss.com/products/seam/spring-seam http://jboss.com/products/seam/spring-seam-2.0.xsd
                              http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
   	default-lazy-init="true">
  -	<!--
  -	
  -	Waiting for SPR-3645
   	
       <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
           <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
  @@ -20,28 +17,34 @@
           <property name="username" value="sa"/>
           <property name="password" value=""/>
       </bean>
  -
  +	<!-- Here we are using a spring configured EMF you can just as easily use a Seam configured EMF using
  +	<persistence:entity-manager-factory/> unless your project depends upon some functionality spring
  +	provides an EMF such as the ability to inject a dataSource.
  +	-->
   	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
   		<property name="dataSource" ref="dataSource"/>
  +		<property name="persistenceUnitName" value="bookingDatabase"/>
   	</bean>
   	
  -	-->
  +	<!-- This example uses resource local JpaTransactionManager.  You could just as easily use a JtaTransactionManager -->
   	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  +		<!-- Be sure to specify the SeamManagedEntityManagerFactory since that will manage the EM that will be
  +		beginning and ending transactions.-->
   	   	<property name="entityManagerFactory" ref="seamEntityManagerFactory"/>
   	</bean>
   
   	<tx:annotation-driven proxy-target-class="true" />
   
  -	<bean id="userService" class="org.jboss.seam.example.spring.UserService">
  -		<seam:component/>
  -	</bean>
  +	<!-- Example using PersistenceAnnotationBeanPostProcessor for persistence -->
  +	<bean id="userService" class="org.jboss.seam.example.spring.UserService"/>
   
  +	<!-- Example using JpaDaoSupport for persistence -->
   	<bean id="bookingService" class="org.jboss.seam.example.spring.BookingService">
   		<property name="entityManagerFactory" ref="seamEntityManagerFactory" />
   		<seam:component/>
   	</bean>
   
  -	<!-- Testing out a seam scope -->
  +	<!-- Testing out a seam scoped spring bean -->
   	<bean id="hotelSearch" class="org.jboss.seam.example.spring.HotelSearchingAction" scope="seam.SESSION">
   		<!-- Testing creation time injection -->
   		<property name="pageSize" value="10" />
  @@ -49,34 +52,21 @@
   
   	<seam:configure-scopes />
   
  -	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
  +	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor">
  +		<!-- Because we have multiple EntityManagerFactories in this applicaitonContext identify the
  +		SeamManagedEntityManagerFactory as the default -->
  +		<property name="defaultPersistenceUnitName" value="conversationScoped"/>
  +	</bean>
   
  +	<!-- EMF that wraps a Seam Managed EM instance for use in Spring -->
   	<bean id="seamEntityManagerFactory" class="org.jboss.seam.ioc.spring.SeamManagedEntityManagerFactoryBean">
  +		<!-- The Seam managed-persistence-context component name. -->
   		<property name="persistenceContextName" value="entityManager" />
  +		<!-- Optionally provide a unit name.  If not specified the default would be the persistenceContextName -->
  +		<property name="persistenceUnitName" value="conversationScoped"/>
   	</bean>
   
  -	<bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean" lazy-init="false">
  -		<property name="scheduledTimerTasks">
  -			<list>
  -				<ref bean="scheduledTask" />
  -			</list>
  -		</property>
  -	</bean>
  -	
  -	<bean id="scheduledTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
  -		<property name="delay" value="10000" />
  -		<property name="period" value="50000" />
  -		<property name="timerTask" ref="doIt" />
  -	</bean>
  -
  -	<bean id="doIt" class="org.springframework.scheduling.timer.MethodInvokingTimerTaskFactoryBean">
  -		<property name="targetObject">
  -			 <!-- could just do a ref="bookingService" here but want to test seam:instance and using an EL expression
  -			 asynchronously. --> 
  -			<seam:instance name="#{bookingService}" />
  -		</property>
  -		<property name="targetMethod" value="testNonWebRequest" />
  -	</bean>
  -
  +	<!-- TaskExecutor for example use of @Asynchronous -->
   	<bean id="springThreadPoolTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor" />
  +
   </beans>
  
  
  
  1.2       +0 -3      jboss-seam/examples/spring/resources/components.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: components.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/spring/resources/components.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- components.xml	3 Jul 2007 20:37:38 -0000	1.1
  +++ components.xml	9 Jul 2007 23:10:53 -0000	1.2
  @@ -14,9 +14,6 @@
                     concurrent-request-timeout="500" 
                     conversation-id-parameter="cid"/>
                     
  -	<persistence:entity-manager-factory name="entityManagerFactory"
  -		persistence-unit-name="bookingDatabase"/>
  -
       <persistence:managed-persistence-context name="entityManager"
                                         auto-create="true" 
                                         entity-manager-factory="#{entityManagerFactory}" />
  
  
  



More information about the jboss-cvs-commits mailing list