Skip to content
Snippets Groups Projects
Verified Commit ba87e2cb authored by Martin Weise's avatar Martin Weise
Browse files
parent eeb8d1fb
No related branches found
No related tags found
2 merge requests!387Wrong model,!384Wrong model
This commit is part of merge request !384. Comments created here will be created in the context of that merge request.
Showing
with 153 additions and 25 deletions
[report] [report]
format = text
omit = omit =
# omit tests # omit tests
./tests/* ./tests/*
......
...@@ -27,7 +27,7 @@ public class Container { ...@@ -27,7 +27,7 @@ public class Container {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(nullable = false) @Column(nullable = false)
...@@ -84,4 +84,11 @@ public class Container { ...@@ -84,4 +84,11 @@ public class Container {
@Column @Column
private String privilegedPassword; private String privilegedPassword;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -13,8 +13,6 @@ import java.time.Instant; ...@@ -13,8 +13,6 @@ import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import static jakarta.persistence.GenerationType.IDENTITY;
@Data @Data
@Entity @Entity
@Builder @Builder
...@@ -31,7 +29,7 @@ public class ContainerImage { ...@@ -31,7 +29,7 @@ public class ContainerImage {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(nullable = false) @Column(nullable = false)
...@@ -81,4 +79,11 @@ public class ContainerImage { ...@@ -81,4 +79,11 @@ public class ContainerImage {
@OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL, CascadeType.PERSIST}, mappedBy = "image") @OneToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL, CascadeType.PERSIST}, mappedBy = "image")
private List<Operator> operators; private List<Operator> operators;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -7,8 +7,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; ...@@ -7,8 +7,6 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.util.UUID; import java.util.UUID;
import static jakarta.persistence.GenerationType.IDENTITY;
@Data @Data
@Entity @Entity
@Builder @Builder
...@@ -22,7 +20,7 @@ public class DataType { ...@@ -22,7 +20,7 @@ public class DataType {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(name = "display_name", nullable = false) @Column(name = "display_name", nullable = false)
...@@ -78,4 +76,11 @@ public class DataType { ...@@ -78,4 +76,11 @@ public class DataType {
}) })
private ContainerImage image; private ContainerImage image;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -20,7 +20,7 @@ public class Operator { ...@@ -20,7 +20,7 @@ public class Operator {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(name = "display_name", nullable = false) @Column(name = "display_name", nullable = false)
...@@ -40,4 +40,11 @@ public class Operator { ...@@ -40,4 +40,11 @@ public class Operator {
}) })
private ContainerImage image; private ContainerImage image;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -43,7 +43,7 @@ public class Database implements Serializable { ...@@ -43,7 +43,7 @@ public class Database implements Serializable {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
...@@ -131,4 +131,11 @@ public class Database implements Serializable { ...@@ -131,4 +131,11 @@ public class Database implements Serializable {
@Column(columnDefinition = "TIMESTAMP") @Column(columnDefinition = "TIMESTAMP")
private Instant lastModified; private Instant lastModified;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -36,7 +36,7 @@ public class View { ...@@ -36,7 +36,7 @@ public class View {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@ToString.Exclude @ToString.Exclude
...@@ -108,4 +108,11 @@ public class View { ...@@ -108,4 +108,11 @@ public class View {
@Column(columnDefinition = "TIMESTAMP") @Column(columnDefinition = "TIMESTAMP")
private Instant lastModified; private Instant lastModified;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -25,7 +25,7 @@ public class ViewColumn implements Comparable<ViewColumn> { ...@@ -25,7 +25,7 @@ public class ViewColumn implements Comparable<ViewColumn> {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@ToString.Exclude @ToString.Exclude
...@@ -62,4 +62,11 @@ public class ViewColumn implements Comparable<ViewColumn> { ...@@ -62,4 +62,11 @@ public class ViewColumn implements Comparable<ViewColumn> {
public int compareTo(ViewColumn viewColumn) { public int compareTo(ViewColumn viewColumn) {
return Integer.compare(this.ordinalPosition, viewColumn.getOrdinalPosition()); return Integer.compare(this.ordinalPosition, viewColumn.getOrdinalPosition());
} }
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -39,7 +39,7 @@ public class Table { ...@@ -39,7 +39,7 @@ public class Table {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(updatable = false, nullable = false) @Column(updatable = false, nullable = false)
...@@ -128,5 +128,12 @@ public class Table { ...@@ -128,5 +128,12 @@ public class Table {
@Column(columnDefinition = "TIMESTAMP") @Column(columnDefinition = "TIMESTAMP")
private Instant lastModified; private Instant lastModified;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -34,7 +34,7 @@ public class TableColumn implements Comparable<TableColumn> { ...@@ -34,7 +34,7 @@ public class TableColumn implements Comparable<TableColumn> {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@ToString.Exclude @ToString.Exclude
...@@ -131,4 +131,11 @@ public class TableColumn implements Comparable<TableColumn> { ...@@ -131,4 +131,11 @@ public class TableColumn implements Comparable<TableColumn> {
public int compareTo(TableColumn tableColumn) { public int compareTo(TableColumn tableColumn) {
return Integer.compare(this.ordinalPosition, tableColumn.getOrdinalPosition()); return Integer.compare(this.ordinalPosition, tableColumn.getOrdinalPosition());
} }
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -32,7 +32,7 @@ public class TableColumnConcept { ...@@ -32,7 +32,7 @@ public class TableColumnConcept {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(updatable = false, nullable = false, columnDefinition = "TEXT") @Column(updatable = false, nullable = false, columnDefinition = "TEXT")
...@@ -59,4 +59,11 @@ public class TableColumnConcept { ...@@ -59,4 +59,11 @@ public class TableColumnConcept {
}, },
joinColumns = @JoinColumn(name = "id", referencedColumnName = "id")) joinColumns = @JoinColumn(name = "id", referencedColumnName = "id"))
private List<TableColumn> columns; private List<TableColumn> columns;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -32,7 +32,7 @@ public class TableColumnUnit { ...@@ -32,7 +32,7 @@ public class TableColumnUnit {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(updatable = false, nullable = false, columnDefinition = "TEXT") @Column(updatable = false, nullable = false, columnDefinition = "TEXT")
...@@ -59,4 +59,11 @@ public class TableColumnUnit { ...@@ -59,4 +59,11 @@ public class TableColumnUnit {
}, },
joinColumns = @JoinColumn(name = "id", referencedColumnName = "id")) joinColumns = @JoinColumn(name = "id", referencedColumnName = "id"))
private List<TableColumn> columns; private List<TableColumn> columns;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -22,7 +22,7 @@ public class ForeignKey { ...@@ -22,7 +22,7 @@ public class ForeignKey {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(name = "fkid", nullable = false, columnDefinition = "VARCHAR(36)") @Column(name = "fkid", nullable = false, columnDefinition = "VARCHAR(36) DEFAULT UUID()")
private UUID id; private UUID id;
@Column(updatable = false, nullable = false) @Column(updatable = false, nullable = false)
...@@ -54,4 +54,11 @@ public class ForeignKey { ...@@ -54,4 +54,11 @@ public class ForeignKey {
@Column(columnDefinition = "VARCHAR(50)") @Column(columnDefinition = "VARCHAR(50)")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private ReferenceType onDelete; private ReferenceType onDelete;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -25,7 +25,7 @@ public class ForeignKeyReference { ...@@ -25,7 +25,7 @@ public class ForeignKeyReference {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@ToString.Exclude @ToString.Exclude
...@@ -48,4 +48,11 @@ public class ForeignKeyReference { ...@@ -48,4 +48,11 @@ public class ForeignKeyReference {
}) })
private TableColumn referencedColumn; private TableColumn referencedColumn;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -22,7 +22,7 @@ public class PrimaryKey { ...@@ -22,7 +22,7 @@ public class PrimaryKey {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(name = "pkid", nullable = false, columnDefinition = "VARCHAR(36)") @Column(name = "pkid", nullable = false, columnDefinition = "VARCHAR(36) DEFAULT UUID()")
private UUID id; private UUID id;
@ToString.Exclude @ToString.Exclude
...@@ -42,4 +42,11 @@ public class PrimaryKey { ...@@ -42,4 +42,11 @@ public class PrimaryKey {
@JoinColumn(name = "cid", referencedColumnName = "id", nullable = false) @JoinColumn(name = "cid", referencedColumnName = "id", nullable = false)
}) })
private TableColumn column; private TableColumn column;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -23,7 +23,7 @@ public class Unique { ...@@ -23,7 +23,7 @@ public class Unique {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(name = "uid", nullable = false, columnDefinition = "VARCHAR(36)") @Column(name = "uid", nullable = false, columnDefinition = "VARCHAR(36) DEFAULT UUID()")
private UUID id; private UUID id;
@Column(updatable = false, nullable = false) @Column(updatable = false, nullable = false)
...@@ -51,4 +51,11 @@ public class Unique { ...@@ -51,4 +51,11 @@ public class Unique {
} }
) )
private List<TableColumn> columns; private List<TableColumn> columns;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -22,7 +22,7 @@ public class Creator { ...@@ -22,7 +22,7 @@ public class Creator {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(name = "given_names") @Column(name = "given_names")
...@@ -106,4 +106,11 @@ public class Creator { ...@@ -106,4 +106,11 @@ public class Creator {
return this.getFirstname().charAt(0) + ". " + this.getLastname(); return this.getFirstname().charAt(0) + ". " + this.getLastname();
} }
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -40,7 +40,7 @@ public class Identifier implements Serializable { ...@@ -40,7 +40,7 @@ public class Identifier implements Serializable {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(name = "qid", columnDefinition = "VARCHAR(36)") @Column(name = "qid", columnDefinition = "VARCHAR(36)")
...@@ -176,6 +176,13 @@ public class Identifier implements Serializable { ...@@ -176,6 +176,13 @@ public class Identifier implements Serializable {
@Column(columnDefinition = "TIMESTAMP") @Column(columnDefinition = "TIMESTAMP")
private Instant lastModified; private Instant lastModified;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -24,7 +24,7 @@ public class IdentifierDescription implements Serializable { ...@@ -24,7 +24,7 @@ public class IdentifierDescription implements Serializable {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(nullable = false, columnDefinition = "TEXT") @Column(nullable = false, columnDefinition = "TEXT")
...@@ -45,6 +45,13 @@ public class IdentifierDescription implements Serializable { ...@@ -45,6 +45,13 @@ public class IdentifierDescription implements Serializable {
}) })
private Identifier identifier; private Identifier identifier;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
...@@ -23,7 +23,7 @@ public class IdentifierFunder implements Serializable { ...@@ -23,7 +23,7 @@ public class IdentifierFunder implements Serializable {
@Id @Id
@JdbcTypeCode(java.sql.Types.VARCHAR) @JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(updatable = false, columnDefinition = "VARCHAR(36)") @Column(columnDefinition = "VARCHAR(36)")
private UUID id; private UUID id;
@Column(nullable = false) @Column(nullable = false)
...@@ -52,6 +52,13 @@ public class IdentifierFunder implements Serializable { ...@@ -52,6 +52,13 @@ public class IdentifierFunder implements Serializable {
}) })
private Identifier identifier; private Identifier identifier;
@PrePersist
public void prePersist() {
if (this.id == null) {
this.id = UUID.randomUUID();
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment