persistence@glassfish.java.net

Re: Timestamp and _at_Temporal

From: sudhakar <sudhakar_at_co.brazos.tx.us>
Date: Wed, 24 Oct 2007 09:42:18 -0500

Getting rid of the @Temporal worked. So out of curiosity is there a use
for Temporal.TIMESTAMP?

-sud

Craig L Russell wrote:
> Hi Sud,
>
> On Oct 21, 2007, at 4:08 PM, sud wrote:
>
>> The following link shows you can place @Temporal annotation on a
>> java.sql.Timestamp
>>
>> http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Temporal
>>
> This link says "for persistent fields or properties of type
> java.util.Date and java.util.Calendar only."
>
> The way I read this is that there is no need for this annotation if
> the type of the persistent field is java.sql.Timestamp.
>
> For Date and Calendar, there are many database types the field could
> be mapped to. For java.sql.Timestamp, there's no ambiguity.
>
> Try removing the @Temporal annotation and see what happens.
>
> Craig
>>
>> But the following code generates error on deployment in Glassfish v2:
>>
>> @Column(name = "createDateTime", nullable = false)
>> @Temporal(value = TemporalType.TIMESTAMP)
>> private java.sql.Timestamp createdDateTime;
>>
>> The error message:
>>
>> "Exception Description: The type [class java.sql.Timestamp] for the
>> attribute [createdDateTime] on the entity class [class
>> brazos.permit.ejb.domain.User] is not a valid type for a temporal
>> mapping. The attribute must be defined as java.util.Date or
>> java.util.Calendar."
>>
>> Can someone confirm if this is a bug or if I'm overlooking something?
>> Thanks
>> -sud
>>
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam? Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>
> Craig Russell
>
> Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>
> 408 276-5638 mailto:Craig.Russell_at_sun.com
>
> P.S. A good JDO? O, Gasp!
>
>