com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column , hibernate
I am getting this error when i am calling a Hibernate Criteria with hibernate beans class. Here is my hibernate bean:
@Id
@Column(name="AD_ID")
private String adId;
@Column(name="VENDOR_LOGIN_ID")
private String vendorLoginId;
@Column(name="NEED_CORRECTION_DATE")
private Date needCorrectionDate;
private Date toDate;
public String getAdId() {
return adId;
}
public void setAdId(String adId) {
this.adId = adId;
}
public String getVendorLoginId() {
return vendorLoginId;
}
public void setVendorLoginId(String vendorLoginId) {
this.vendorLoginId = vendor开发者_如何学PythonLoginId;
}
public Date getNeedCorrectionDate() {
return needCorrectionDate;
}
public void setNeedCorrectionDate(Date needCorrectionDate) {
this.needCorrectionDate = needCorrectionDate;
}
public void setToDate(Date toDate) {
this.toDate = toDate;
}
public Date getToDate() {
return toDate;
}
I am using an attribute in hibernate beans which is not mapped with any column of table. I am doing this because i dont want to use form bean in DAO, thats why i have created a new attribute and setting the form bean's value into hibernate bean and then run a Criteria. But this is giving me error:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'this_.toDate' in 'field list'
Please tell me how can i handle this error, or any better way to transfer data from 'form bean' to hibernate DAO. Or any annotation which tells the hibernate to not bind that attribute with table.
Thanks Shams
I have found the answer.
I have just added @Transient on that attribute. And it is working fine....
精彩评论