-->
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: Unnecessary SQL generated
PostPosted: Fri Mar 26, 2004 4:34 am 
Regular
Regular

Joined: Wed Mar 03, 2004 9:38 am
Posts: 70
Using the criteria API to retrieve all the objects from a specific class, the DAO method looks something like:

Code:
Criteria criteria = createCriteria(session, entityClass);
return criteria.list();


and it should then be equal to

Code:
return (List) session.find("from fully.qualified.class.Name");


The find method generates SQL code as expected, i.e. it looks something like

Code:
SELECT name0_.id, name0_.someproperty, name0_.etc FROM my_table_for_name name0_


However, the criteria method generates essentially the same SQL (ok, it uses "this" instead of "name0_" but otherwise it's the same), but adds a

Code:
WHERE 1=1


at the end. This doesn't really affect anything in my case at least, but it's, well, ugly.

Using Hibernate 2.1.2 and PostgreSQL 7.4.2.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 26, 2004 3:20 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I don't think you should worry about such minor impl details, or provide a patch to fix that

_________________
Emmanuel


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.