dataAccessContext.xml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE beans PUBLIC
  3. "-//SPRING//DTD BEAN//EN"
  4. "http://www.springframework.org/dtd/spring-beans.dtd">
  5. <!--
  6. iEat Data Access Context
  7. This Spring bean context is used to define components of the iEat
  8. application which vary between running the application in different
  9. environments, for example as a web application or as JUnit test
  10. cases.
  11. -->
  12. <beans>
  13. <!-- DataSource to the iEat application database. -->
  14. <bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
  15. <property name="jndiName"><value>java:comp/env/jdbc/ieat</value></property>
  16. </bean>
  17. <!-- JNDI-bound javax.mail.Session for use in JNDI-enabled container. -->
  18. <bean id="myMailSession" class="org.springframework.jndi.JndiObjectFactoryBean">
  19. <property name="jndiName"><value>java:/comp/env/mail/ieat</value></property>
  20. </bean>
  21. <!-- Spring MailSender implementation for sending system emails. -->
  22. <bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
  23. <property name="session"><ref bean="myMailSession"/></property>
  24. </bean>
  25. <bean id="domainObjectFactory" class="magoffin.matt.ieat.biz.impl.JAXBDomainObjectFactoryImpl"/>
  26. <!-- Hibernate SessionFactory definition. -->
  27. <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  28. <property name="dataSource"><ref local="myDataSource"/></property>
  29. <property name="mappingResources">
  30. <list>
  31. <value>ieat.hbm.xml</value>
  32. <value>magoffin/matt/ieat/domain/Base.hbm.xml</value>
  33. <value>magoffin/matt/ieat/domain/Course.hbm.xml</value>
  34. <value>magoffin/matt/ieat/domain/Difficulty.hbm.xml</value>
  35. <value>magoffin/matt/ieat/domain/Ethnicity.hbm.xml</value>
  36. <value>magoffin/matt/ieat/domain/Ingredient.hbm.xml</value>
  37. <value>magoffin/matt/ieat/domain/Meal.hbm.xml</value>
  38. <value>magoffin/matt/ieat/domain/MealRecipe.hbm.xml</value>
  39. <value>magoffin/matt/ieat/domain/PrepTime.hbm.xml</value>
  40. <value>magoffin/matt/ieat/domain/Recipe.hbm.xml</value>
  41. <value>magoffin/matt/ieat/domain/RecipeComment.hbm.xml</value>
  42. <value>magoffin/matt/ieat/domain/RecipeIngredient.hbm.xml</value>
  43. <value>magoffin/matt/ieat/domain/RecipeRating.hbm.xml</value>
  44. <value>magoffin/matt/ieat/domain/RecipeStep.hbm.xml</value>
  45. <value>magoffin/matt/ieat/domain/RelatedRecipe.hbm.xml</value>
  46. <value>magoffin/matt/ieat/domain/RelationKind.hbm.xml</value>
  47. <value>magoffin/matt/ieat/domain/System.hbm.xml</value>
  48. <value>magoffin/matt/ieat/domain/Unit.hbm.xml</value>
  49. <value>magoffin/matt/ieat/domain/User.hbm.xml</value>
  50. </list>
  51. </property>
  52. <property name="hibernateProperties">
  53. <props>
  54. <prop key="hibernate.dialect">${hibernate.dialect}</prop>
  55. <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
  56. <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
  57. <prop key="hibernate.max_fetch_depth">4</prop>
  58. </props>
  59. </property>
  60. </bean>
  61. <!-- Transaction implementation. -->
  62. <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  63. <property name="sessionFactory"><ref local="mySessionFactory"/></property>
  64. <property name="dataSource"><ref local="myDataSource"/></property>
  65. </bean>
  66. </beans>