package <%=packageName%>.domain;

<% if (databaseType == 'sql') { %>import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Type;<% } %>
import org.joda.time.LocalDateTime;<% if (databaseType == 'nosql') { %>
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;<% } %><% if (databaseType == 'sql') { %>
import javax.persistence.*;<% } %>
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.Map;

/**
 * Persist AuditEvent managed by the Spring Boot actuator
 * @see org.springframework.boot.actuate.audit.AuditEvent
 */

<% if (databaseType == 'sql') { %>@Entity
@Table(name = "T_PERSISTENT_AUDIT_EVENT")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)<% } %><% if (databaseType == 'nosql') { %>
@Document(collection = "T_PERSISTENT_AUDIT_EVENT")<% } %>
public class PersistentAuditEvent  {

    @Id<% if (databaseType == 'sql') { %>
    @GeneratedValue(strategy = GenerationType.TABLE)
    @Column(name = "event_id")<% } %><% if (databaseType == 'nosql') { %>
    @Field("event_id")<% } %>
    private Long id;

    @NotNull
    private String principal;

    <% if (databaseType == 'sql') { %>@Column(name = "event_date")
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")<% } %>
    private LocalDateTime auditEventDate;
    <% if (databaseType == 'sql') { %>
    @Column(name = "event_type")<% } %><% if (databaseType == 'nosql') { %>
    @Field("event_type")<% } %>
    private String auditEventType;

    <% if (databaseType == 'sql') { %>@ElementCollection
    @MapKeyColumn(name="name")
    @Column(name="value")
    @CollectionTable(name="T_PERSISTENT_AUDIT_EVENT_DATA", joinColumns=@JoinColumn(name="event_id"))<% } %>
    private Map<String, String> data = new HashMap<>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPrincipal() {
        return principal;
    }

    public void setPrincipal(String principal) {
        this.principal = principal;
    }

    public LocalDateTime getAuditEventDate() {
        return auditEventDate;
    }

    public void setAuditEventDate(LocalDateTime auditEventDate) {
        this.auditEventDate = auditEventDate;
    }

    public String getAuditEventType() {
        return auditEventType;
    }

    public void setAuditEventType(String auditEventType) {
        this.auditEventType = auditEventType;
    }

    public Map<String, String> getData() {
        return data;
    }

    public void setData(Map<String, String> data) {
        this.data = data;
    }
}

@@ -1261,16 +1261,87 @@
 @NotNull
+%3C%25 if (databaseType == 'sql') %7B %25%3E%0A    @Column(nullable = false)%3C%25 %7D %25%3E
 %0A    pri

Set nullable false to match liquibase changeset and constraint validation