diff options
author | mrfoxygmfr <mrfoxygmfr@sch9.ru> | 2025-03-23 14:50:35 +0300 |
---|---|---|
committer | mrfoxygmfr <mrfoxygmfr@sch9.ru> | 2025-03-23 14:50:35 +0300 |
commit | 20255f9fd6f126077d3cb51ac003c166221d4015 (patch) | |
tree | 0662c5cc9b6df740d6fa467f86197a6bfcb41cda | |
parent | 4bc6b0e87dbc4f2fd6d74ac97606c457aeba4db6 (diff) |
fix(db/models): change primary key strategy and remove extra NotNull annotations
7 files changed, 7 insertions, 15 deletions
diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java index 51b8bbd..1f5b911 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java @@ -16,7 +16,7 @@ import java.util.Set; @AllArgsConstructor public class Operation { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.AUTO) @Column(nullable = false, name = "id") private int id; diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/OperationProducts.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/OperationProducts.java index 9eaeab1..0842437 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/OperationProducts.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/OperationProducts.java @@ -13,7 +13,7 @@ import lombok.*; @AllArgsConstructor public class OperationProducts { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.AUTO) @Column(nullable = false, name = "id") private int id; @@ -28,6 +28,5 @@ public class OperationProducts { private Product product; @Column(nullable = false, name = "amount") - @NonNull private long amount; } diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java index 78f203c..13d24c0 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Partner.java @@ -15,7 +15,7 @@ import java.util.Set; @AllArgsConstructor public class Partner { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.AUTO) @Column(nullable = false, name = "id") private int id; diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/PartnerContact.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/PartnerContact.java index e25d178..2299e8e 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/PartnerContact.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/PartnerContact.java @@ -13,7 +13,7 @@ import lombok.*; @AllArgsConstructor public class PartnerContact { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.AUTO) @Column(nullable = false, name = "id") private int id; diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Product.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Product.java index 5211eaf..3d97271 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Product.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Product.java @@ -16,7 +16,7 @@ import java.time.Duration; @AllArgsConstructor public class Product { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.AUTO) @Column(nullable = false, name = "id") private int id; @@ -30,15 +30,12 @@ public class Product { private ProductType type; @Column(nullable = false, name = "height") - @NonNull private long height; @Column(nullable = false, name = "width") - @NonNull private long width; @Column(nullable = false, name = "depth") - @NonNull private long depth; @Column(nullable = true, name = "max_storage_duration", columnDefinition = "interval") diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/ProductSlots.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/ProductSlots.java index 7c24e5b..4065dc8 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/ProductSlots.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/ProductSlots.java @@ -15,7 +15,7 @@ import java.sql.Timestamp; @AllArgsConstructor public class ProductSlots { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.AUTO) @Column(nullable = false, name = "id") private int id; @@ -31,7 +31,6 @@ public class ProductSlots { private StorageSlot slot; @Column(nullable = false, name = "amount") - @NonNull private long amount; @Column(nullable = false, name = "status") diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/StorageSlot.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/StorageSlot.java index 7486b21..424cab2 100644 --- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/StorageSlot.java +++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/StorageSlot.java @@ -13,7 +13,7 @@ import lombok.*; @AllArgsConstructor public class StorageSlot { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.AUTO) @Column(nullable = false, name = "id") private int id; @@ -22,14 +22,11 @@ public class StorageSlot { private String location; @Column(nullable = false, name = "height") - @NonNull private long height; @Column(nullable = false, name = "width") - @NonNull private long width; @Column(nullable = false, name = "depth") - @NonNull private long depth; } |