title: How to configure Spring Data JPA using XML
body: <p>I'm reading the book "Professional Java for Web Applications - Nicholas S. Williams"
  The book example has this configuration for Spring Data JPA:</p>
  
  <pre><code>@Bean
  public DataSource customerSupportDataSource()
  {
      JndiDataSourceLookup lookup = new JndiDataSourceLookup();
      return lookup.getDataSource("jdbc/CustomerSupport");
  }
  
  @Bean
  public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean()
  {
      Map&lt;String, Object&gt; properties = new Hashtable&lt;&gt;();
      properties.put("javax.persistence.schema-generation.database.action",
              "none");
      properties.put("hibernate.ejb.use_class_enhancer", "true");
  
      HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
      adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
  
      LocalContainerEntityManagerFactoryBean factory =
              new LocalContainerEntityManagerFactoryBean();
      factory.setJpaVendorAdapter(adapter);
      factory.setDataSource(this.customerSupportDataSource());
      factory.setPackagesToScan("com.wrox.site.entities",
              "com.wrox.site.converters");
      factory.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
      factory.setValidationMode(ValidationMode.NONE);
      factory.setLoadTimeWeaver(this.loadTimeWeaver); // TODO: remove when SPR-10856 fixed
      factory.setJpaPropertyMap(properties);
      return factory;
  }
  
  @Bean
  public PlatformTransactionManager jpaTransactionManager()
  {
      return new JpaTransactionManager(
              this.entityManagerFactoryBean().getObject()
      );
  }
  </code></pre>
  
  <p>But I have been configuring using XML, I cannot figure out how to translate this to XML only, I have this so far</p>
  
  <pre><code>&lt;jee:jndi-lookup id="myDataSource" jndi-name="java:comp/env/jdbc/test"/&gt;
  
  &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="entityManagerFactory" ref="myEmf" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property name="dataSource" ref="myDataSource" /&gt;
      &lt;property name="packagesToScan" value="com.test" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Can any one guide me how to convert this?</p>
  
  <p>Thanks</p>