|
7 | 7 |
|
8 | 8 | import java.util.Properties;
|
9 | 9 | import javax.sql.DataSource;
|
| 10 | +import org.fao.geonet.auditable.UsernameAuditorAware; |
10 | 11 | import org.fao.geonet.repository.GeonetRepositoryImpl;
|
11 | 12 | import org.springframework.beans.factory.annotation.Autowired;
|
12 | 13 | import org.springframework.context.annotation.Bean;
|
13 | 14 | import org.springframework.context.annotation.Configuration;
|
14 | 15 | import org.springframework.context.annotation.Profile;
|
| 16 | +import org.springframework.data.domain.AuditorAware; |
| 17 | +import org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean; |
15 | 18 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
16 | 19 | import org.springframework.orm.jpa.JpaVendorAdapter;
|
17 | 20 | import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
18 | 21 | import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
19 | 22 | import org.springframework.transaction.annotation.EnableTransactionManagement;
|
20 | 23 |
|
| 24 | + |
21 | 25 | @Configuration
|
22 | 26 | @EnableTransactionManagement
|
23 | 27 | @EnableJpaRepositories(
|
24 | 28 | basePackages = "org.fao.geonet.repository",
|
25 | 29 | entityManagerFactoryRef = "gnEntityManager",
|
26 |
| - repositoryBaseClass = GeonetRepositoryImpl.class) |
| 30 | + repositoryBaseClass = GeonetRepositoryImpl.class, |
| 31 | + repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class) |
27 | 32 | @Profile("!withoutSql")
|
28 | 33 | public class PersistenceConfig {
|
29 | 34 |
|
@@ -54,4 +59,9 @@ public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
54 | 59 |
|
55 | 60 | return em;
|
56 | 61 | }
|
| 62 | + |
| 63 | + @Bean |
| 64 | + public AuditorAware<String> auditingProvider() { |
| 65 | + return new UsernameAuditorAware(); |
| 66 | + } |
57 | 67 | }
|
0 commit comments