The query does not return anything. Can anybody help me with this ?
This is the code
String queryStr = "from PasswordExpiration passObj " + " where ( passObj.lastUpdateTimeOfAttribute + :expirePeriod - :notificationPeriod ) >= :todaysdate " ;
Query query = session.createQuery(queryStr);
Date d = new Date();
Timestamp ts = new Timestamp(d.getTime());
query.setTimestamp("todaysdate",ts);
int expirePeriod = def.getTaAttrPolicy().getDaysToExpire(); int warnPeriod = def.getTaAttrPolicy().getDaysToWarn();
query.setInteger("expirePeriod", expirePeriod);
query.setInteger("notificationPeriod", warnPeriod);
results = query.list();
The class is
/**
* @hibernate.class table="PasswordExpiration"
*/
public class PasswordExpiration implements Serializable {
private int id = 0;
private int passAttrDefId;
private Timestamp lastUpdateTimeOfAttribute;
private Timestamp lastUpdateTime;
private String userName;
private int userId;
/**
* @hibernate.id column="passwordExpId" type="int"
* generator-class="com.trulogica.truaccess.idgen.util.HibernateIdGenerator"
* unsaved-value="0"
* @hibernate.generator-param name="TableName" value="PasswordExpiration"
*/
public int getId() {
return id;
}
public void setId(int _id) {
id = _id;
}
/**
* @hibernate.property column="passAttrDefId" type="int" not-null="true"
*/
public int getPassAttrDefId() {
return passAttrDefId;
}
public void setPassAttrDefId(int _passAttrDefId) {
passAttrDefId = _passAttrDefId;
}
/**
* @hibernate.property column="lastUpdateTime" type="timestamp" not-null="true"
*/
public Timestamp getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Timestamp _lastUpdateTime) {
lastUpdateTime = _lastUpdateTime;
}
/**
* @hibernate.property column="lastUpdateTimeOfAttribute" type="timestamp" not-null="true"
*/
public Timestamp getLastUpdateTimeOfAttribute() {
return lastUpdateTimeOfAttribute;
}
public void setLastUpdateTimeOfAttribute(Timestamp _lastUpdateTimeOfAttribute) {
lastUpdateTimeOfAttribute = _lastUpdateTimeOfAttribute;
}
/**
* @hibernate.property column="userId" type="int" not-null="true"
*/
public int getUserId() {
return userId;
}
public void setUserId(int _userId) {
userId = _userId;
}
/**
* @hibernate.property column="userName" type="string" not-null="true"
*/
public String getUserName(){
return userName;
}
public void setUserName(String _userName) {
userName = _userName;
}
public String toString()
{
StringBuffer lBuffer = new StringBuffer();
lBuffer.append("username: >").append(userName).append(",\n");
lBuffer.append("userId: >").append(userId).append(",\n");
lBuffer.append("lastUpdateTime: >").append(lastUpdateTime).append(",\n");
lBuffer.append("lastUpdateTimeOfAttribute: >").append(lastUpdateTimeOfAttribute).append(",\n");
lBuffer.append("passAttrDefId: >").append(passAttrDefId).append(",\n");
lBuffer.append("primaryid : >").append(id);
return lBuffer.toString();
}
}
Any help is appreciated
|