Remove abstract class of entities.
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
package org.cerberus.entities.persistence;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.PrePersist;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
abstract class AbstractEntity {
|
||||
@Id
|
||||
protected UUID id;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,17 @@ package org.cerberus.entities.persistence;
|
||||
|
||||
import org.hibernate.annotations.Proxy;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name="application")
|
||||
@Proxy(lazy = false)
|
||||
public class Application extends AbstractEntity {
|
||||
public class Application {
|
||||
@Id
|
||||
private UUID id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
@@ -24,6 +25,19 @@ public class Application extends AbstractEntity {
|
||||
@OneToMany(mappedBy = "application")
|
||||
private List<ApplicationRole> administratorList;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,15 @@ package org.cerberus.entities.persistence;
|
||||
import org.hibernate.annotations.Proxy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name="configuration_file")
|
||||
@Proxy(lazy = false)
|
||||
public class ConfigurationFile extends AbstractEntity {
|
||||
public class ConfigurationFile {
|
||||
@Id
|
||||
private UUID id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String path;
|
||||
|
||||
@@ -15,6 +19,19 @@ public class ConfigurationFile extends AbstractEntity {
|
||||
@JoinColumn(name = "application_id")
|
||||
private Application application;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -4,17 +4,18 @@ import org.hibernate.annotations.Generated;
|
||||
import org.hibernate.annotations.GenerationTime;
|
||||
import org.hibernate.annotations.Proxy;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name="`user`")
|
||||
@Proxy(lazy = false)
|
||||
public class User extends AbstractEntity {
|
||||
public class User {
|
||||
@Id
|
||||
private UUID id;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String name;
|
||||
|
||||
@@ -34,6 +35,19 @@ public class User extends AbstractEntity {
|
||||
@OneToMany(mappedBy = "user")
|
||||
private List<ApplicationRole> applicationRoleList;
|
||||
|
||||
@PrePersist
|
||||
public void prePersist() {
|
||||
id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user