FetchType « Map « JPA Q&A





1. Hibernate Criteria returns children multiple times with FetchType.EAGER    stackoverflow.com

I have an Order class that has a list of OrderTransactions and I mapped it with a one-to-many Hibernate mapping like so:

@OneToMany(targetEntity = OrderTransaction.class, cascade = CascadeType.ALL)
public List<OrderTransaction> getOrderTransactions() {
  ...

2. JPA and eclipselink - Overriding FetchType.Eager    stackoverflow.com

I have a class where a few members have annotation:

@ManyToOne(fetch = FetchType.EAGER)
In the specific part of my program, these load far too many data. Unfortunately, I can't change these annotations as ...

3. Does work @ManyToMany(fetch = FetchType.EAGER)?    forum.hibernate.org

I have annotated a relation as follow Code: @ManyToMany(fetch = FetchType.EAGER) @MapKeyColumn(name = "E_TPSISDK_K_ORDINAMENTO") @JoinTable(name = "V_DCM_TYPE_CLASS", joinColumns = { @JoinColumn(name = "K_DOCUMENTO_AZIENDALE", referencedColumnName = "K_DOCUMENTO_AZIENDALE"), @JoinColumn(name = "K_SOTTO_APPLICAZIONE", referencedColumnName = "K_SOTTO_APPLICAZIONE") }, inverseJoinColumns ...

4. Filter on entity association mapping vs FetchType.EAGER    forum.hibernate.org

@org.hibernate.annotations.FilterDefs(@org.hibernate.annotations.FilterDef(name = "childFilter")) @Entity public class Parent { @Id @GeneratedValue private Long id; @OneToMany(mappedBy = "parent", fetch = FetchType.EAGER) @org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @org.hibernate.annotations.Filter(name = "childFilter", condition = "id = 2") private Set childs = new HashSet(); public Set getChilds() { return childs; } } @Entity public class Child { ...