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 org.hibernate.annotations.Proxy;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="application")
|
@Table(name="application")
|
||||||
@Proxy(lazy = false)
|
@Proxy(lazy = false)
|
||||||
public class Application extends AbstractEntity {
|
public class Application {
|
||||||
|
@Id
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@@ -24,6 +25,19 @@ public class Application extends AbstractEntity {
|
|||||||
@OneToMany(mappedBy = "application")
|
@OneToMany(mappedBy = "application")
|
||||||
private List<ApplicationRole> administratorList;
|
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() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,15 @@ package org.cerberus.entities.persistence;
|
|||||||
import org.hibernate.annotations.Proxy;
|
import org.hibernate.annotations.Proxy;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="configuration_file")
|
@Table(name="configuration_file")
|
||||||
@Proxy(lazy = false)
|
@Proxy(lazy = false)
|
||||||
public class ConfigurationFile extends AbstractEntity {
|
public class ConfigurationFile {
|
||||||
|
@Id
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
@@ -15,6 +19,19 @@ public class ConfigurationFile extends AbstractEntity {
|
|||||||
@JoinColumn(name = "application_id")
|
@JoinColumn(name = "application_id")
|
||||||
private Application application;
|
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() {
|
public String getPath() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,17 +4,18 @@ import org.hibernate.annotations.Generated;
|
|||||||
import org.hibernate.annotations.GenerationTime;
|
import org.hibernate.annotations.GenerationTime;
|
||||||
import org.hibernate.annotations.Proxy;
|
import org.hibernate.annotations.Proxy;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.*;
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="`user`")
|
@Table(name="`user`")
|
||||||
@Proxy(lazy = false)
|
@Proxy(lazy = false)
|
||||||
public class User extends AbstractEntity {
|
public class User {
|
||||||
|
@Id
|
||||||
|
private UUID id;
|
||||||
|
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@@ -34,6 +35,19 @@ public class User extends AbstractEntity {
|
|||||||
@OneToMany(mappedBy = "user")
|
@OneToMany(mappedBy = "user")
|
||||||
private List<ApplicationRole> applicationRoleList;
|
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() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user