I have an entity with @OneToOne relation between entities country -> language.
EntityCountry relation with language works as FetchType EAGER (default):
@JoinColumn(name = "language_id", updatable = false, insertable = false)
@OneToOne
private LanguageEntity language;
But I don’t want EAGER, so I try LAZY, this both configurations work:
This two, although it is EAGER, throws a query during retrieveing the information to get the language:
@JoinColumn(name = "language_id", updatable = false, insertable = false)
@Fetch(FetchMode.SELECT)
@OneToOne(fetch = FetchType.EAGER)
private LanguageEntity language;
@JoinColumn(name = "language_id", updatable = false, insertable = false)
@Fetch(FetchMode.JOIN)
@OneToOne(fetch = FetchType.LAZY)
private LanguageEntity language;
Anyway, I want the easiest configuration and this should work (neither of this two work), and I don’t know why is not working (just default LAZY in a @OneToOne relation):
@JoinColumn(name = "language_id", updatable = false, insertable = false)
@OneToOne(fetch = FetchType.LAZY)
private LanguageEntity language;
@JoinColumn(name = "language_id", updatable = false, insertable = false)
@Fetch(FetchMode.SELECT)
@OneToOne(fetch = FetchType.LAZY)
private LanguageEntity language;
I’m using Hibernate 5.2.17 and elide io 4.2.8