Commit ad9cbb06 authored by Matija Obreza's avatar Matija Obreza
Browse files

Enabled Spring JPA auditing

- orm.xml listener is apparently still required
parent 29ec6c81
......@@ -37,7 +37,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.PropertySource;
import org.springframework.dao.support.PersistenceExceptionTranslator;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
......@@ -59,8 +58,7 @@ import liquibase.integration.spring.SpringLiquibase;
entityManagerFactoryRef = "entityManagerFactory",
transactionManagerRef = "transactionManager")
@EnableTransactionManagement
@EnableJpaAuditing(auditorAwareRef = "auditorAware", modifyOnCreate = true)
@PropertySource({"classpath:application.properties"})
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
public class DatabaseConfig {
private static final String[] JPA_PACKAGES = { "org.genesys.blocks.model", "org.genesys.blocks.security.model", "org.genesys.blocks.auditlog.model", "org.genesys.common.model",
"org.genesys.catalog.model", "org.genesys.blocks.oauth.model", "org.genesys.filerepository.model" };
......
<!--
Copyright 2017 Global Crop Diversity Trust
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Apparently needed for Spring JPA Auditing -->
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd" version="2.0">
<persistence-unit-metadata>
<persistence-unit-defaults>
<entity-listeners>
<entity-listener class="org.springframework.data.jpa.domain.support.AuditingEntityListener" />
</entity-listeners>
</persistence-unit-defaults>
</persistence-unit-metadata>
</entity-mappings>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment