I am using hibernate 3.0.5.
Problem description follows:
I have the following report query which works fine:
select new NewsRow (news.id, news.title, news.body) from News news
NewsRow is just a DTO object. It has two contructors:
NewsRow(Integer id, String title, String body)
and
NewsRow(Integer id, String title, String body, Timestamp creationTs)
News is a mapped entity. News, among its intance fields, has a creation timestamp value (java.sql.Timestamp) which is mapped to a column in the database.
I modified the report query above to also include the creation timestamp:
select new NewsRow (news.id, news.title, news.body, news.creationTs) from News news
For some reason unknown to me, now it fails with the following error:
org.hibernate.hql.ast.QuerySyntaxError: Unable to locate appropriate constructor on class [NewsRow]. I am not quite sure why I am getting this error since there is a compatible constructor in the NewsRow class (see above).
Is it just that timestamps cannot be used in report queries? I am thinking this cannot be it... has someone run into this problem? Thanks.
|