fa4def8fe3f12a13a5453011a0fa91670a2d5697
[utils] /
1 package org.wamblee.support.persistence.hibernate;
2
3 import java.util.Map;
4
5 import org.dbunit.dataset.filter.ITableFilterSimple;
6 import org.wamblee.support.persistence.JpaCustomizer;
7 import org.wamblee.support.persistence.PersistenceUnitDescription;
8
9 public class HibernateJpaCustomizer implements JpaCustomizer {
10
11     public HibernateJpaCustomizer() { 
12         // Empty
13     }
14     
15     @Override
16     public void customize(PersistenceUnitDescription aPersistenceUnit, Map<String, String> aJpaProperties) {
17         // Hibernate: Override transaction type and datasource
18         aJpaProperties.put("javax.persistence.transactionType", "RESOURCE_LOCAL");
19         aJpaProperties.put("javax.persistence.jtaDataSource", null);
20         aJpaProperties.put("javax.persistence.nonJtaDataSource", aPersistenceUnit.getJndiName());
21         
22         // Hibernate schema generation
23         aJpaProperties.put("hibernate.hbm2ddl.auto", "create");     
24     }
25     
26     @Override
27     public ITableFilterSimple getJpaTables() {
28         return new HibernateTables();
29     }
30
31 }