Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Fetching with Eclipselink

Hi Leon,

There is an EclipseLink JoinFetch annotation that can be used to acheive this. You can take a look at it in the API documentation:


Leon Derks wrote:

I have an object Product with a @ManyToOne relation to a Category Object.

Default the fetch type of this relation is EAGER (Category is loaded, when Product is loaded). But when I load a Product by Id, I see there is a second select that loads the Category object.

This is not what I want. Why doesn't eclipselink translates thisautomatically in one single query?

I temporary solved this by defining a named query: select p from Product p inner join fetch p.category where = :productId.

Now a product and its category are loaded in one select statement.

Is there a way to let eclipselink automatically load the objects in one select or do I always have to use a named query for this?


eclipselink-users mailing list

Back to the top