Hi there
I have am using hibernate annotation. I would like to create a read-only calculated field which comprises of the difference between the end and start dates, which are both mapped fields in my annotation.
After reviewing the docs, I tried to do this:
Code:
@Column(name="Started")
private Date started;
@Column(name="Ended")
private Date ended;
@Formula ("ended - started")
private Date duration;
This does NOT work - after running the query, I receive this exception:
Caused by: org.hibernate.AnnotationException: java.util.Date collection not yet supported: com.prod.repository.Sessionduration
Any idea as to how to corerctly define and use the @formula annotation??
Thanks
E.
Hibernate version:
3.1
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt: