-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Eager fetched bag with eager fetched set = config error?
PostPosted: Thu Nov 16, 2006 1:50 pm 
Newbie

Joined: Sun May 15, 2005 1:55 pm
Posts: 2
According to this post, Hibernate complains about 'cannot simultaneously fetch multiple bags' if there are multiple eager-fetched bags to be fetched in the same time as the refering entity.

However, if there are one bag and one set, the error is not reported, but the same problem (cartesian product for the bag) arises. Is this intended?

To be more specific:

This reports 'cannot simultaneously fetch multiple bags':
Code:
@Entity
public class Customer implements Serializable {
    @Id
    public int customerId;
    @OneToMany(fetch=FetchType.EAGER, mappedBy="customer")
    public List<Location> locations;
    @OneToMany(fetch=FetchType.EAGER, mappedBy="customer")
    public List<Invoice> invoices;
}


This does not report 'cannot simultaneously fetch multiple bags', but the actual invoice count is locations.size() times more than real customer's invoice count.
Code:
@Entity
public class Customer implements Serializable {
    @Id
    public int customerId;
    @OneToMany(fetch=FetchType.EAGER, mappedBy="customer")
    public Set<Location> locations;
    @OneToMany(fetch=FetchType.EAGER, mappedBy="customer")
    public List<Invoice> invoices;
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.