diff --git a/src/main/java/com/uniovi/entities/ApiKey.java b/src/main/java/com/uniovi/entities/ApiKey.java index ae52345f..464ff90f 100644 --- a/src/main/java/com/uniovi/entities/ApiKey.java +++ b/src/main/java/com/uniovi/entities/ApiKey.java @@ -21,7 +21,7 @@ public class ApiKey { @Column(unique = true) private String key = UUID.randomUUID().toString(); - @OneToOne(mappedBy = "apiKey") + @OneToOne private Player player; @OneToMany(mappedBy = "apiKey") diff --git a/src/main/java/com/uniovi/entities/Player.java b/src/main/java/com/uniovi/entities/Player.java index 4ee6d958..2575c789 100644 --- a/src/main/java/com/uniovi/entities/Player.java +++ b/src/main/java/com/uniovi/entities/Player.java @@ -39,7 +39,7 @@ public class Player implements JsonEntity { @OneToMany(mappedBy = "player", cascade = CascadeType.REMOVE) private Set gameSessions = new HashSet<>(); - @OneToOne(cascade = CascadeType.PERSIST, mappedBy = "player") + @OneToOne(cascade = CascadeType.ALL, mappedBy = "player") private ApiKey apiKey; // Transient: no se almacena en la base de datos