On 01/18/2012 11:36 AM, Guillaume Delhumeau wrote:
Let me explain you.
1) We have a "MyTests.TestClass" class which contains a unique field "date" of type "date".
2) The current document have a single object of type "MyTests.TestClass". You can set whatever you want for the value of the field "date".
3) The current document code is:
{{velocity}} = History = #set($revs = $doc.getRecentRevisions(10)) #foreach($rev in $revs) #set($oldDoc = $doc.getDocumentRevision($rev)) #set($prop = $oldDoc.getObject('MyTests.TestClass').getProperty('date').getValue()) == Rev : $rev == * Class: $prop.class.name * Value : $prop #end = End History = {{/velocity}}
4) Do some edit in order to have something to display in the history
5) Here are my results:
History Rev : 17.1
Class: java.sql.Timestamp Value : 2012-12-10 00:00:00.0
Rev : 16.1
Class: java.util.Date Value : Mon Dec 10 00:00:00 CET 2012
Rev : 15.1
Class: java.util.Date Value : Mon Dec 10 00:00:00 CET 2012
6) The problem is that the field "date" is a java.sql.Timestamp for the current version but then become a java.util.Date.
Is it normal ?
It's somewhat normal, meaning that the two classes are compatible, and straight from the database we get a Timestamp. I fixed a similar problem a long time ago. You should report this on Jira. -- Sergiu Dumitriu http://purl.org/net/sergiu/