-->
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: help w/ Criteria
PostPosted: Fri May 30, 2008 3:40 pm 
Newbie

Joined: Fri May 30, 2008 3:17 pm
Posts: 2
i'm havng a bit of time trying to convert this query to a Criteria. somebody please tell me if there's a better way than using a criteria.

Code:
SELECT * FROM tow
  WHERE towId IN (
    SELECT towId FROM towstatuschange
    WHERE towId NOT IN (select towId from towstatuschange
           where (newTowStatusId in (104,105) AND date < DATEADD(minute, -10, getdate())) group by towId)
   GROUP BY towId
)



i have pojos for the Tow table and TowStatusChange table.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 31, 2008 7:56 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Have a look at detachedcriteria to create subqueries with criteria. -> reference doc

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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.