You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2014/05/06 22:18:16 UTC
[jira] [Commented] (CXF-5731) FIQL: Optimizing queries with JPA
[ https://issues.apache.org/jira/browse/CXF-5731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13991074#comment-13991074 ]
Sergey Beryozkin commented on CXF-5731:
---------------------------------------
Thanks for the patch
> FIQL: Optimizing queries with JPA
> ---------------------------------
>
> Key: CXF-5731
> URL: https://issues.apache.org/jira/browse/CXF-5731
> Project: CXF
> Issue Type: Improvement
> Components: JAX-RS
> Affects Versions: 3.0.0-milestone1, 3.0.0-milestone2, 2.7.11
> Reporter: Romain Castan
> Assignee: Sergey Beryozkin
> Labels: patch
> Fix For: 2.7.12, 3.0.0
>
> Attachments: patch.txt
>
>
> I analysed the query generated because I had some performance problems.
> I saw that the joins are created for each FIQL expression.
> If two FIQL expressions require the same join it's not necessary to create two joins.
> I enabled the log to display the query with hibernate:
> add this line <property name="hibernate.show_sql" value="true"/> in persistance.xml
> I launched the following unit test: JPATypedQueryVisitorTest.testAndQueryCollection
> The query result is:
> select
> book0_.id as id0_,
> book0_.houseNumber as houseNum2_0_,
> book0_.street as street0_,
> book0_.bookTitle as bookTitle0_,
> book0_.library_id as library7_0_,
> book0_.dateOfBirth as dateOfBi5_0_,
> book0_.thename as thename0_
> from Book book0_
> inner join Book_authors authors1_ on book0_.id=authors1_.Book_id
> inner join Book_BookReview reviews2_ on book0_.id=reviews2_.Book_id
> inner join BookReview bookreview3_ on reviews2_.reviews_id=bookreview3_.id
> inner join Book_BookReview reviews4_ on book0_.id=reviews4_.Book_id
> inner join BookReview bookreview5_ on reviews4_.reviews_id=bookreview5_.id
> inner join BookReview_authors authors6_ on bookreview5_.id=authors6_.BookReview_id
> where
> cast(book0_.id as integer)=10
> and authors1_.authors=?
> and bookreview3_.review=?
> and authors6_.authors=?
> There are two "inner join" which are not necessary because they are duplicated.
> The query could be:
> select
> book0_.id as id0_,
> book0_.houseNumber as houseNum2_0_,
> book0_.street as street0_,
> book0_.bookTitle as bookTitle0_,
> book0_.library_id as library7_0_,
> book0_.dateOfBirth as dateOfBi5_0_,
> book0_.thename as thename0_
> from Book book0_
> inner join Book_authors authors1_ on book0_.id=authors1_.Book_id
> inner join Book_BookReview reviews2_ on book0_.id=reviews2_.Book_id
> inner join BookReview bookreview3_ on reviews2_.reviews_id=bookreview3_.id
> inner join BookReview_authors authors4_ on bookreview3_.id=authors4_.BookReview_id
> where
> cast(book0_.id as integer)=10
> and authors1_.authors=?
> and bookreview3_.review=?
> and authors4_.authors=?
--
This message was sent by Atlassian JIRA
(v6.2#6252)