Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] multible fetch joins

Is there an eager relationship to the "localized_article" that is not joined in the relationship? 
Also unless you actually need multiple levels of fetching (which you are not using in your example) you could simply write the query as:
"SELECT a FROM Article a JOIN FETCH a.locals"
--Gordon

Michael Simons wrote:
Hi Tom,

so now I'm using hints on queries like
query.setHint("eclipselink.join-fetch", "e.address");

Unfortunately this doesn't work like expected, at least not always.

(Model: Article(1:N)LocalizedArticle

The following code
		query = em.createQuery ("SELECT a from Article a");
		query.setHint ("eclipselink.left-join-fetch", "a.locals");
		query.getResultList ();

leads to the following SQL:

[EL Fine]: 2009-12-01
18:42:20.748--ServerSession(8279577)--Connection(7438069)--Thread(Thread[main,5,main])--SELECT
t1.article_id, t1.needs_addtank, t1.ext_id, t1.jdo_version, t1.alt_ex_id, t1.product_id,
t1.caution_id, t0.localized_article_id, t0.nme, t0.jdo_version, t0.article_id, t0.lnguage_id
FROM article t1 LEFT OUTER JOIN localized_article t0 ON (t0.article_id = t1.article_id)

[EL Fine]: 2009-12-01
18:42:20.763--ServerSession(8279577)--Connection(7438069)--Thread(Thread[main,5,main])--SELECT
localized_article_id, nme, jdo_version, article_id, lnguage_id FROM localized_article WHERE
(article_id = ?)

The second statement is repeated for each Article.

I don't understand why the second statement is generated at all. All columns are already part of
the first statement.

Might this be a bug? I guess it might because this happens not always.
I assured that the association is FetchType=LAZY in both directions.
Any help would be appreciated.

-Michael


Tom Ware schrieb:
  
Hi Michael,

  The limitation on JPQL fetch joins comes from the JPA specification.

  Have a look at the following link to see how you can get multiple
fetch joins in all versions of EclipseLink.

http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Join_Fetch


  We are currently considering what the feature set will be for
EclipseLink 2.1 and the following enhancement request covers expanding
EclipseLink's JPQL capabilities beyond the JPA spec.  Please feel free
to vote for it and add any comments you have.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814

-Tom



Michael Simons wrote:
    
Hello [EclipseLink 1.2.0, database=MySQL 5],

I'm trying to port a client/server application first to JPA to enable
the 3-tier migration.
At the moment I try to use EclipseLink as JPA implementation.

EclipseLink 1.2.0 does not support multible fetch joins like
select a from A a fetch join A.b b ...
because the alias 'b' is already denied.

Will this be supported in the 2.x of EclipseLink?

Kind Regards,
Michael

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
      
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

    

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
  

Back to the top