<beans xmlns="http://www.springframework.org/schema/beans"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xmlns:context="http://www.springframework.org/schema/context"

  xmlns:tx="http://www.springframework.org/schema/tx"

  xmlns:p="http://www.springframework.org/schema/p"

  xmlns:util="http://www.springframework.org/schema/util"

  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

    http://www.springframework.org/schema/tx

    http://www.springframework.org/schema/tx/spring-tx-2.5.xsd

    http://www.springframework.org/schema/util

    http://www.springframework.org/schema/util/spring-util-2.5.xsd">

  <context:component-scan base-package="zzz.rambutan" />

  <context:annotation-config/>

  <bean id="propertyPlaceHolder"

     class="zzz.rambutan.spring.config.PlaceholderConfigurer" >

     <property name="location"

       value="file:${application.root}configuration.properties"/>

  </bean>

  <tx:annotation-driven />

  <bean id="transactionManager"

    class="org.springframework.orm.jpa.JpaTransactionManager">

    <property name="entityManagerFactory"

      ref="entityManagerFactory" />

   </bean>

   <bean id="jpaTemplate"

     class="org.springframework.orm.jpa.JpaTemplate">

    <property name="entityManagerFactory" ref="entityManagerFactory" />

  </bean>

  <bean id="entityManagerFactory"

    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"

    p:persistenceXmlLocation="classpath*:META-INF/persistence.xml"

    p:persistenceUnitName="carelink"

    p:dataSource-ref="jpaDataSource"

    p:jpaVendorAdapter-ref="hibernateVendor"

    p:jpaPropertyMap-ref="jpaPropertyMap">

  </bean>

  <bean id=" jpaDataSource"

    class="org.springframework.jdbc.datasource.DriverManagerDataSource"

    p:driverClassName="${zzz.rambutan.driver}"

    p:url="${zzz.rambutan.url}"

    p:username="${zzz.rambutan.user}"

    p:password="${zzz.rambutan.password}"

    />

  <bean id="hibernateVendor"

   class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"

   p:showSql="false"/>

  <util:map id="jpaPropertyMap">

    <entry key="hibernate.dialect"

      value="${zzz.rambutan.hibernate.dialect}"/>

    <entry key="hibernate.show_sql" value="${zzz.rambutan.hibernate.showSql}"/>

    <entry key="hibernate.format_sql" value="true"/>

    <entry key="hibernate.query.substitutions"

      value="yes 'Y', no 'N'"/>

    <entry key="hibernate.hibernate.bytecode.use_reflection_optimizer"

      value="true"/>

    <entry key="hibernate.archive.autodetection"

      value="class, hbm"/>

  </util:map >

  <bean id="emfSetter" class="zzz.rambutan.services.EMF">

    <property name="entityManagerFactory" ref="entityManagerFactory"/>

  </bean>

</beans>