ElementsCollection with List of Embeddables and FetchType.Eager result in wrong fetch

Description

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
}

Environment

MYSQL 5, Hibernate Core and Annotation 3.5.4-Final

Activity

Show:
Edmondo Porcu
April 12, 2011, 10:48 AM

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)

Brett Meyer
April 7, 2014, 5:45 PM

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!

Brett Meyer
July 8, 2014, 3:11 PM

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!

Rejected

Assignee

Unassigned

Reporter

Edmondo Porcu

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Critical