Commit 9b2ccaf4 authored by Matija Obreza's avatar Matija Obreza
Browse files

VersionedModelWithoutId should have 1 as first persisted version

parent 8d3cf213
...@@ -19,6 +19,7 @@ import java.io.Serializable; ...@@ -19,6 +19,7 @@ import java.io.Serializable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import javax.persistence.Version; import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonView; import com.fasterxml.jackson.annotation.JsonView;
...@@ -42,6 +43,14 @@ public abstract class VersionedModelWithoutId implements Serializable, Activatab ...@@ -42,6 +43,14 @@ public abstract class VersionedModelWithoutId implements Serializable, Activatab
@Column(nullable = false) @Column(nullable = false)
protected boolean active = VersionedModel.DEFAULT_ACTIVE_VALUE; protected boolean active = VersionedModel.DEFAULT_ACTIVE_VALUE;
/**
* First persisted version is 1
*/
@PrePersist
private void prepersistVersionedModel() {
version = 1;
}
/** /**
* Gets the version. * Gets the version.
* *
......
Markdown is supported
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