I have the following JPA Query:
SELECT NEW test.vo.HappyVO(o.acid, o.dest, o.dep, o.time) FROM HappyTable1 o
My HappyVO has the following constructor:
public HappyVO(String a, String b, String c, java.sql.Timestamp e)
When i run this query i get the following error:
org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [test.vo.HappyVO]
if i change the constructor to
public HappyVO(String a, String b, String c, Object e)
the error doesn't occur and variable e is an instance of java.sql.Timestamp
Forgot to mention i'm using a MySQL database, and the column is of type timestamp and declared type of the time field in HappyTable1 is java.sql.Timestamp
It looks a lot like this known Hibernate bug: https://hibernate.atlassian.net/browse/HHH-4179
The suggested workaround is to use a Date type in your POJO constructor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With