openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sutter" <kwsut...@gmail.com>
Subject Limitations of eager fetching?
Date Thu, 23 Aug 2007 14:12:23 GMT
Hi Guys,
Can someone help me interpret a limitation specified in section 7.2:


   - Once OpenJPA eager-joins into a class, it cannot issue any further
   eager to-many joins or parallel selects from that class in the same query.
   To-one joins, however, can recurse to any level.

So, if I have the following code, am I hitting this limitation?

public abstract class AbstractCustomer implements Serializable {

    ...
    @OneToOne(fetch = FetchType.EAGER)
    @JoinColumns({@JoinColumn(name="OPEN_ORDER", referencedColumnName =
"ORDER_ID")})
    protected Order openOrder;


public class Order implements Serializable {

    ...

    @OneToMany(fetch=FetchType.LAZY)
    @ElementJoinColumn(name="ORDER_ID",referencedColumnName="ORDER_ID")
    protected Set<LineItem> lineitems;


In order to load all LineItems Eagerly, I have to start from Order (vs
starting from Customer).

If I do an em.find() on Customer.  Even if I specify Eager from Order to
LineItems, it will not load the LineItems Eagerly.  Only if I do an
em.findon the Order will I get the Join because LineItems is a
collection.

Have I interpretted the limitation correctly?  And, if so, can somebody
provide some background on this limitation and what it would take to remove
it?  I'm still not 100% comfortable with this area of the code...  :-)

Thanks!
Kevin

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message