Add test - self referencing relationships: ResourceFile

This commit is contained in:
Rob Bygrave
2014-04-29 22:25:14 +12:00
parent 066b409a65
commit a9c8d1960c
3 changed files with 127 additions and 0 deletions
@@ -0,0 +1,33 @@
package com.avaje.tests.model.selfref;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
@MappedSuperclass
public abstract class BaseResourceFile {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "id", nullable = false, length = 64)
private String id;
public BaseResourceFile() {
this.id = newId();
}
public String getId() {
return id;
}
protected void setId(String id) {
this.id = id;
}
protected String newId() {
return UUID.randomUUID().toString();
}
}