aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrfoxygmfr <mrfoxygmfr@sch9.ru>2025-03-24 01:32:31 +0300
committermrfoxygmfr <mrfoxygmfr@sch9.ru>2025-03-24 01:32:31 +0300
commit768d605845c6479373a51975b48eab7807c5a29c (patch)
tree7450fe52e696550712907a93f6ecbf67ea0aa014
parente40750eb6ff6d8f78a092257669fd5dddc106df3 (diff)
fix(db): save many-to-one references
-rw-r--r--src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfig.java1
-rw-r--r--src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/Operation.java4
-rw-r--r--src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/OperationProducts.java4
-rw-r--r--src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/PartnerContact.java2
-rw-r--r--src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/models/ProductSlots.java4
5 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfig.java b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfig.java
index 7f7948a..014db7b 100644
--- a/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfig.java
+++ b/src/main/java/ru/mrfoxygmfr/warehouse_accounting/db/config/HibernateConfig.java
@@ -27,6 +27,7 @@ public class HibernateConfig {
sessionFactory.setPackagesToScan("ru.mrfoxygmfr.warehouse_accounting.db.models");
Properties hibernateProperties = new Properties();
+ hibernateProperties.setProperty("hibernate.enable_lazy_load_no_trans", "true");
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", "update");
hibernateProperties.setProperty("connection_pool_size", "1");
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..d1eb400 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
@@ -21,7 +21,7 @@ public class Operation {
private int id;
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "partner_id", referencedColumnName = "id", insertable = false, updatable = false)
+ @JoinColumn(name = "partner_id", referencedColumnName = "id")
@NonNull
private Partner partner;
@@ -53,7 +53,7 @@ public class Operation {
private String address;
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "responsible_id", referencedColumnName = "id", insertable = false, updatable = false)
+ @JoinColumn(name = "responsible_id", referencedColumnName = "id")
@NonNull
private PartnerContact responsible;
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..2a842a2 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
@@ -18,12 +18,12 @@ public class OperationProducts {
private int id;
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "operation_id", referencedColumnName = "id", insertable = false, updatable = false)
+ @JoinColumn(name = "operation_id", referencedColumnName = "id")
@NonNull
private Operation operation;
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "product_id", referencedColumnName = "id", insertable = false, updatable = false)
+ @JoinColumn(name = "product_id", referencedColumnName = "id")
@NonNull
private Product product;
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..c783d64 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
@@ -18,7 +18,7 @@ public class PartnerContact {
private int id;
@ManyToOne(fetch = FetchType.LAZY)
- @JoinColumn(name = "partner_id", referencedColumnName = "id", insertable = false, updatable = false)
+ @JoinColumn(name = "partner_id", referencedColumnName = "id")
@NonNull
private Partner partner;
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..640ef6f 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
@@ -21,12 +21,12 @@ public class ProductSlots {
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "product_id", referencedColumnName = "id", insertable = false, updatable = false)
+ @JoinColumn(name = "product_id", referencedColumnName = "id")
@NonNull
private Product product;
@ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "slot_id", referencedColumnName = "id", insertable = false, updatable = false)
+ @JoinColumn(name = "slot_id", referencedColumnName = "id")
@NonNull
private StorageSlot slot;