-->
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.  [ 2 posts ] 
Author Message
 Post subject: JIRA? won't Criteria API resolve nested properties like HQL?
PostPosted: Thu Jan 05, 2006 9:20 pm 
Regular
Regular

Joined: Mon Sep 29, 2003 9:39 am
Posts: 67
If Criteria API is the best choice for dynamicly building queries, for user-configured reports, for example, then it should be easier to
add nested properties to the criteria.

Currently, you must createAlias() or createCriteria() for each association
in the query. Because there is no way to 'query' the Criteria object for
existing aliases, the application developer must keep track of aliases in order to avoid duplicate associations throwing a QueryException.

HQL implicitly resolves these associations. It is less convenient and more error-prone to use HQL to generate where and order by clauses, but associations are easier.

HQL:
"select my.friend.name from Person my"

Criteria API:
criteria.createCriteria("friend"); //without this, query will fail.
projectionList.add(Projections.property("friend.name"));
criteria.setProjection(projectionList);

The code that checks if "friend" has already been added has been omitted.

JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 05, 2006 10:09 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
JIRA HHH-1162 already touches on this. Certainly more intelligence needs to be worked into the handling of nested properties.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.