entitygraph

JPA: EntityGraph and map

拟墨画扇 提交于 2020-12-13 18:46:05
问题 I use EclipseLink 2.6.3 as JPA provider. I have two entities: @Entity public class ClassA{ @Id private String uuid; private String comment; @OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL,mappedBy = "classA",orphanRemoval = false) @MapKey(name="code") private Map<String,ClassB> texts; //+ getters and setters } @Entity public class ClassB { @Id private String uuid; private String code; private String name; @ManyToOne @JoinColumn(name = "comeColname") private ClassA classA; //

JPA: EntityGraph and map

痴心易碎 提交于 2020-12-13 18:44:01
问题 I use EclipseLink 2.6.3 as JPA provider. I have two entities: @Entity public class ClassA{ @Id private String uuid; private String comment; @OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL,mappedBy = "classA",orphanRemoval = false) @MapKey(name="code") private Map<String,ClassB> texts; //+ getters and setters } @Entity public class ClassB { @Id private String uuid; private String code; private String name; @ManyToOne @JoinColumn(name = "comeColname") private ClassA classA; //

JPA inheritance @EntityGraph include optional associations of subclasses

不想你离开。 提交于 2020-08-24 05:13:09
问题 Given the following domain model, I want to load all Answer s including their Value s and their respective sub-children and put it in an AnswerDTO to then convert to JSON. I have a working solution but it suffers from the N+1 problem that I want to get rid of by using an ad-hoc @EntityGraph . All associations are configured LAZY . @Query("SELECT a FROM Answer a") @EntityGraph(attributePaths = {"value"}) public List<Answer> findAll(); Using an ad-hoc @EntityGraph on the Repository method I can

JPA inheritance @EntityGraph include optional associations of subclasses

六月ゝ 毕业季﹏ 提交于 2020-08-24 05:12:10
问题 Given the following domain model, I want to load all Answer s including their Value s and their respective sub-children and put it in an AnswerDTO to then convert to JSON. I have a working solution but it suffers from the N+1 problem that I want to get rid of by using an ad-hoc @EntityGraph . All associations are configured LAZY . @Query("SELECT a FROM Answer a") @EntityGraph(attributePaths = {"value"}) public List<Answer> findAll(); Using an ad-hoc @EntityGraph on the Repository method I can

EclipseLink query exceptions using EntityGraph: “You must define a fetch group manager at descriptor” AND “Fetch group cannot be set on report query”

爱⌒轻易说出口 提交于 2020-06-29 03:53:00
问题 I have the following design: For reference, I'm only posting the SimpleGame entity: @Entity @Table(name = "\"SimpleGames\"") @NamedQuery(name = SimpleGame.FIND_ALL, query = "SELECT ga FROM SimpleGame ga") @NamedQuery(name = SimpleGame.FIND_ALL_JOIN_SCORES_GROUP_BY_GAME_ID, query = "SELECT ga FROM SimpleGame ga JOIN ga.simpleScores sc GROUP BY ga.id") @NamedEntityGraph(name = SimpleGame.FETCH_SCORES, attributeNodes = {@NamedAttributeNode("simpleScores")}) public class SimpleGame implements