-->
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.  [ 1 post ] 
Author Message
 Post subject: Using Restricitons and Projections
PostPosted: Thu Nov 18, 2010 3:45 pm 
Newbie

Joined: Thu Nov 18, 2010 2:05 pm
Posts: 1
Hi all,

I have 2 classes - Distributor{
Date signUpDate;
}
and
Transactions {
int sponsorId;
Date orderDate;
//which has an instance of member class
}

This is wat i have written to compare orderDate >= signUpDate and orderDate <= signUpDate+31

Criteria crit = session.createCriteria(Transactions.class,"ord");
crit.add(Restrictions.eq("ord.sponsorId", sponsorId));
crit.add(Restrictions.ge("ord.orderDate", "ord.distributor.signupDate"));
crit.add(Restrictions.le("ord.orderDate", "ord.distributor.signupDate"+31));

I know this is wrong since i ma getting classcastException, can someone please tell correct way of doing this.

Thanks.


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

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.