Hi,
Can anyone help with the following?
I am getting the following error:
org.hibernate.hql.PARSER *** ERROR: line 1:144: unexpected token: date
when I run the HQL:
FROM Customer as c where c.firstName LIKE :firstName and c.surname=:surname and c.dob=:dob and c.memberEndDate>current date
I am using Hibernate 3.0 with Db2.
There is no error when I remove the "and c.memberEndDate>current date"
My mapping is:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="au.com.hbf.travel.model.Customer"
table="WW202_CUSTOMER"
>
<id
name="id"
type="java.lang.Integer"
column="CUSTOMER"
>
</id>
<property
name="surname"
type="java.lang.String"
column="SURNAME"
not-null="true"
length="30"
/>
<property
name="firstName"
type="java.lang.String"
column="GIVEN"
not-null="true"
length="30"
/>
<property
name="dob"
type="java.sql.Date"
column="BIRTH_DTE"
not-null="true"
length="10"
/>
<property
name="memberEndDate"
type="java.sql.Date"
column="MEMBER_END_DTE"
not-null="true"
length="10"
/>
</class>
</hibernate-mapping>
and the class is:
Code:
public class Customer extends BaseTravelModel
{
private String firstName = null;
private String surname = null;
private Date dob = null;
private Date memberEndDate = null;
public Customer()
{
super();
}
public Customer(String id, String firstName, String surname, Date dob)
{
super(id);
this.firstName = firstName;
this.surname = surname;
this.dob = dob;
}
public Date getDob()
{
return dob;
}
public String getFirstName()
{
return firstName;
}
public String getSurname()
{
return surname;
}
public void setDob(Date date)
{
dob = date;
}
public void setFirstName(String string)
{
firstName = string;
}
public void setSurname(String string)
{
surname = string;
}
public Date getMemberEndDate()
{
return memberEndDate;
}
public void setMemberEndDate(Date date)
{
memberEndDate = date;
}
protected String paramString()
{
super.paramString();
StringBuffer buffer = new StringBuffer();
buffer.append( "FirstName = " + getFirstName() );
buffer.append( "Surname = " + this.getSurname() );
buffer.append( "DOB = " + this.getDob() );
buffer.append( "EndDate = " + this.getMemberEndDate() );
return buffer.toString();
}
}