Skip to content

Commit efa4eb0

Browse files
committed
optimizing hibernate (reducing RAM)
1 parent b0b4e23 commit efa4eb0

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

services/recom-backend/src/main/java/com/recom/entity/map/GameMap.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ public class GameMap implements Persistable<Long>, Serializable {
3535
@Column(insertable = true, updatable = false, nullable = false, length = 255)
3636
private String name;
3737

38-
@OneToOne(mappedBy = "gameMap", fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
38+
@OneToOne(mappedBy = "gameMap", fetch = FetchType.EAGER, cascade = CascadeType.PERSIST, orphanRemoval = true)
3939
private MapDimensions mapDimensions;
4040

4141
@Builder.Default
42-
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
42+
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, orphanRemoval = true)
4343
private Set<MapStructureEntity> mapStructures = new HashSet<>();
4444

4545
@Builder.Default
46-
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
46+
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, orphanRemoval = true)
4747
private Set<SquareKilometerTopographyChunk> topographyChunks = new HashSet<>();
4848

4949
@Builder.Default
50-
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
50+
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, orphanRemoval = true)
5151
private Set<SquareKilometerStructureChunk> structureChunks = new HashSet<>();
5252

5353
@Builder.Default
54-
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
54+
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, orphanRemoval = true)
5555
private Set<Configuration> configurations = new HashSet<>();
5656

5757
@Builder.Default
58-
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
58+
@OneToMany(mappedBy = "gameMap", fetch = FetchType.LAZY, cascade = CascadeType.PERSIST, orphanRemoval = true)
5959
private Set<Message> messages = new HashSet<>();
6060

6161

services/recom-backend/src/main/java/com/recom/entity/map/SquareKilometerTopographyChunk.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class SquareKilometerTopographyChunk implements Persistable<Long>, Serial
3939
private Long squareCoordinateY; // Down to Up | 0 ---> ...
4040

4141
@Lob
42+
@Basic(fetch = FetchType.LAZY)
4243
@Column(insertable = true, updatable = true, nullable = true)
4344
private byte[] data;
4445

0 commit comments

Comments
 (0)