[
http://issues.apache.org/jira/browse/GRFT-72?page=comments#action_12357587 ]
Martin Koci commented on GRFT-72:
---------------------------------
I think with this solution following is not possible:
Custom node type with property of type Date:
<propertyDefinition name="jcr:lastModified" requiredType="Date"
autoCreated="false" mandatory="true" onParentVersion="IGNORE" protected="false"
multiple="false"/>
jcrmapping with that property:
<field-descriptor fieldName="lastModified"
jcrName="jcr:lastModified" />
Domain object with that property:
protected Date lastModified;
Jackrabbit throws exception because UtilDateTypeConverterImpl returns LongValue
object but property is declared as Date.
This can be fixed with changing requiredType="Date" to requiredType="Long" but
I want use Date type with JCR. Jcrmapping can support saving/converting Date
properties as Longs as optional feature.
> Bug in
> org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.UtilDateTypeConverterImpl
> -----------------------------------------------------------------------------------------------------
>
> Key: GRFT-72
> URL: http://issues.apache.org/jira/browse/GRFT-72
> Project: Graffito
> Type: Bug
> Components: JCR-Mapping
> Reporter: Martin Koci
> Assignee: Christophe Lombart
> Attachments: UtilDateTypeConverterImpl.patch
>
> In this converter following line is used:
> return this.getValueFactory().createValue(((java.util.Date)
> propValue).getTime());
> but propValue must be converted to java.util.Calendar, not into long!
> ValueFactory than converts to LongValue not DateValue as expected.
> Following code works OK:
> final long timeInMilis = ((java.util.Date) propValue).getTime();
> final Calendar calendar = Calendar.getInstance();
> calendar.setTimeInMillis(timeInMilis);
> return this.getValueFactory().createValue( calendar );
> but I dont know better Date-> Calendar conversion.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira