[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6112) ElementsCollection with List of Embeddables and FetchType.Eager result in wrong fetch

Edmondo Porcu (JIRA) noreply at atlassian.com
Tue Apr 12 04:48:59 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42012#action_42012 ] 

Edmondo Porcu commented on HHH-6112:
------------------------------------

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)


> ElementsCollection with List of Embeddables and FetchType.Eager result in wrong fetch
> -------------------------------------------------------------------------------------
>
>                 Key: HHH-6112
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6112
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations
>    Affects Versions: 3.5.4
>         Environment: MYSQL 5, Hibernate Core and Annotation 3.5.4-Final
>            Reporter: Edmondo Porcu
>            Priority: Critical
>
> 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
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list