Skip to content

Instantly share code, notes, and snippets.

@xenoterracide
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xenoterracide/0611398e4abbf4ad9153 to your computer and use it in GitHub Desktop.
Save xenoterracide/0611398e4abbf4ad9153 to your computer and use it in GitHub Desktop.
package com.lm.model;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.UUID;
@Entity
@Table(name = "tasks")
public class Task {
@Id
@NotNull
@Type(type = "pg-uuid") // only works for postgres
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "task_id", columnDefinition = "uuid")
private UUID id;
@NotNull
@Size(min = 1, max = 100)
private String description;
public String getDescription() {
return description;
}
public void setDescription(final String description) {
this.description = description;
}
public UUID getId() {
return id;
}
public void setId(final UUID id) {
this.id = id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment