File tree 2 files changed +6
-1
lines changed
openbas-api/src/main/java/io/openbas
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 7
7
import java .util .ArrayList ;
8
8
import java .util .List ;
9
9
import lombok .Getter ;
10
+ import org .hibernate .Hibernate ;
10
11
import org .springframework .web .multipart .MultipartFile ;
11
12
12
13
@ Getter
@@ -39,8 +40,11 @@ public ExecutableInject(
39
40
this .direct = direct ;
40
41
this .users = users ;
41
42
this .teams = teams ;
43
+ this .teams .forEach (team -> Hibernate .initialize (team .getTags ()));
42
44
this .assets = assets ;
45
+ this .assets .forEach (asset -> Hibernate .initialize (asset .getTags ()));
43
46
this .assetGroups = assetGroups ;
47
+ this .assetGroups .forEach (assetGroup -> Hibernate .initialize (assetGroup .getTags ()));
44
48
this .teamSize = teams .size ();
45
49
this .documentSize = injection .getInject ().getDocuments ().size ();
46
50
}
Original file line number Diff line number Diff line change @@ -105,14 +105,15 @@ public List<ExecutableInject> getInjectsToRun() {
105
105
.sorted (Inject .executionComparator )
106
106
.map (
107
107
inject -> {
108
+ // TODO This is inefficient, we need to refactor this loop with our own query
108
109
Hibernate .initialize (inject .getTags ());
109
110
Hibernate .initialize (inject .getUser ());
110
111
return new ExecutableInject (
111
112
true ,
112
113
false ,
113
114
inject ,
114
115
getInjectTeams (inject ),
115
- inject .getAssets (),
116
+ inject .getAssets (), // TODO There is also inefficient lazy loading inside this get function
116
117
inject .getAssetGroups (),
117
118
usersFromInjection (inject ));
118
119
});
You can’t perform that action at this time.
0 commit comments