-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: JPA criteria performance
PostPosted: Fri Nov 20, 2015 9:46 am 
Newbie

Joined: Fri Nov 20, 2015 9:37 am
Posts: 1
Hi,

I realize that the implementation of jpa criteria isn't perfect.
When using it, hibernate seem to build a jpql that need to be parse again.

Right?

Any project to get rid of that?


Top
 Profile  
 
 Post subject: Re: JPA criteria performance
PostPosted: Mon Nov 23, 2015 10:17 am 
Regular
Regular

Joined: Mon Oct 19, 2015 7:49 am
Posts: 61
Location: ChengDu China
Hi Jonleyo

This is a so good question! :)

I found this problem and I decide to resolve it in my framework several years ago, but I finally give up it because time is not enough.

The current solution:

Code:
JPA Criteria -> JPQL Source Code -> HQL AST(by antlr parser) -> SQL AST(by antlr walker) -> Generated SQL


The better solution:

Code:
JPA Criteria(Enahanced HQL AST)--\
                                 +-> SQL AST(by antlr walker) -> Gnerated SQL
JPQLSource Code-> HQL AST--------/


Let the JPA Criteria to be the enahced HQL AST directly(Criteria class implements the same internal interface of AST), then the JPA Criteria need not to use the QueryPlanCache and HQL Compiler.

I hope this functionality will be implemented by Hibernate in the future, I believe it can become stronger and stronger in the future.


Top
 Profile  
 
 Post subject: Re: JPA criteria performance
PostPosted: Mon Nov 23, 2015 11:06 am 
Regular
Regular

Joined: Mon Oct 19, 2015 7:49 am
Posts: 61
Location: ChengDu China
Like the classic QueryPlanCache for HQL/JPQL, this solution need a cache too, maybe its name should be CriteriaQueryPlanCache:)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.