Commit e27ee1fc authored by Matija Obreza's avatar Matija Obreza

Use @Type(type = "uuid-binary") for UUID

parent 6dc323df
......@@ -23,8 +23,9 @@ import java.util.UUID;
* UUID column should not be updatable:
*
* <pre>
* &#64;Column(updatable = false, nullable = false, columnDefinition = "binary(16)")
* private UUID uuid;
* &#64;Column(unique = true, updatable = false, nullable = false)
* &#64;@Type(type = "uuid-binary")
* protected UUID uuid;
* </pre>
*
* The entity must generate a UUID before persisting the data:
......
......@@ -21,6 +21,8 @@ import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import org.hibernate.annotations.Type;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
......@@ -35,7 +37,8 @@ public abstract class UuidModel extends AuditedVersionedModel implements IdUUID
private static final long serialVersionUID = 2639238742778129554L;
/** The uuid. */
@Column(unique = true, updatable = false, nullable = false, columnDefinition = "binary(16)")
@Column(unique = true, updatable = false, nullable = false)
@Type(type = "uuid-binary")
protected UUID uuid;
/**
......
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