From 4c05c668cbef981ae528fb2db98bd9dc81c47363 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Wed, 13 May 2020 13:42:43 +0200 Subject: [PATCH] Define lazy and eager fetching explicit --- backend/src/main/java/de/hft/geotime/record/TimeRecord.java | 4 ++-- backend/src/main/java/de/hft/geotime/user/TimetrackUser.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/de/hft/geotime/record/TimeRecord.java b/backend/src/main/java/de/hft/geotime/record/TimeRecord.java index c349c58..1405cf6 100644 --- a/backend/src/main/java/de/hft/geotime/record/TimeRecord.java +++ b/backend/src/main/java/de/hft/geotime/record/TimeRecord.java @@ -18,8 +18,8 @@ public class TimeRecord { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; - @OneToOne - private TimetrackAccount account; // TimetrackAccount ID (Lazy) + @OneToOne(fetch = FetchType.LAZY) + private TimetrackAccount account; private Date startdate; private Date enddate; private Duration time; diff --git a/backend/src/main/java/de/hft/geotime/user/TimetrackUser.java b/backend/src/main/java/de/hft/geotime/user/TimetrackUser.java index ff3c30c..d8b7d32 100644 --- a/backend/src/main/java/de/hft/geotime/user/TimetrackUser.java +++ b/backend/src/main/java/de/hft/geotime/user/TimetrackUser.java @@ -30,7 +30,7 @@ public class TimetrackUser { private String lastname; - @OneToOne + @OneToOne(fetch = FetchType.EAGER) private Role role; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.ALL)