Dear all,
a simple collection of embeddables who is not a set cannot be fetched correctly by Hibernate if one needs a fetchType.Eager .
@Column(nullable=true)
@IndexColumn(name="Ordinal")
@JoinColumn(name = "Curve_curveName")
@ElementCollection(fetch = FetchType.EAGER)
private List<CurveInstrument> oisList;
I have been forced to add the indexColumn to avoid fetching multiple bags at once, and this worked fine in persisting my objects. When i retrieve them from the database, however, my list contains only the first element of the collection I have persisted.
@Embeddable
public class CurveInstrument implements Serializable {
private static final long serialVersionUID = 4797265087176461985L;
private String name;
@Column(nullable=true)
@Type(type="org.hibernate.type.NumericBooleanType")
private boolean active = false;
@Column(nullable=true)
private double value=0;
@Column(nullable=true)
private double spread=0;
// Getters and setters
}
MYSQL 5, Hibernate Core and Annotation 3.5.4-Final
I had found a solution to the issue, but I really don't like it. I guess it takes ages to people to find it:
@Column(nullable=true)
@OrderColumn(name="Ordinal")
@JoinTable(name= "tenor6mcurve_fras6m",joinColumns=@JoinColumn(name = "Tenor6MCurve_curveName"))
@Fetch(value = FetchMode.SELECT)
@ElementCollection(fetch=FetchType.EAGER)
In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.
If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.
Thank you!
Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!