У меня есть объект UserProfile, который содержит ссылку на объект TwitchAccount через отношение один к одному, как показано здесь:
TwitchAccount.java:
@OneToOne(mappedBy = "twitchAccount")
private UserProfile profile;
UserProfile.java:
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "twitchAccountId", referencedColumnName = "twitchAccountId")
private TwitchAccount twitchAccount;
Когда я выполняю запрос GET для определенного объекта TwitchAccount, кажется, что между ними наблюдается рекурсия:
{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":{"id":8,"firstName":null,"lastName":null,"profilePicUrl":null,"birthday":null,"steamId":null,"xblId":null,"psnId":null,"epicId":null,"discordId":null,"twitchAccount":{"id":1,"state":"525367bb-ca4c-4131-ac52-e29aafdb7dc1","code":null,"userProfile":
Как я могу остановить эту рекурсию,и как я могу сделать так, чтобы учетная запись twitch даже не возвращала json, связанный с объектом профиля пользователя (объект учетной записи twitch не должен иметь возможность устанавливать или получать профиль пользователя в любом случае)?