[
https://issues.apache.org/jira/browse/CXF-5731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14017609#comment-14017609
]
Sergey Beryozkin commented on CXF-5731:
---------------------------------------
Hi, can I resolve this issue now, I believe we've fixed the regression as part
of other JIRA ?
> 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
> Attachments: patch-reopen.txt, 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:
> {code:borderStyle=solid}
> 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=?
> {code}
> There are two "inner join" which are not necessary because they are
> duplicated.
> The query could be:
> {code:borderStyle=solid}
> 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=?
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)