Hi Matt,

Matt Benson wrote:
> You need to be using PersistentLocalDateTime, IIRC.
>   
Thanks for the reply.  Unfortunately, I've been looking for just that,
but there isn't any class by that name in the joda-time-hibernate
package.  There's no PersistentLocalDateTime mentioned in the Javadoc
either, neither Release nor Development.  I tried Googling for
PersistentLocalDateTime and that turned up nothing.
> --- Rob Hills <[EMAIL PROTECTED]> wrote:
>   
>> I'm using Joda-time 1.5 with joda-time-hibernate 1.0
>> on my AppFuse 2.0 + Struts 2 project.  My app server
>> is Tomcat 5.5 and the 
>> DB is Postgresql 8.1
>>
>> I am using the joda LocalDateTime throughout my app
>> and am trying to persist it to the Database using
>> PersistentDateTime 
>> (observing that there appears to be no
>> PersistentLocalDateTime class).  However, when
>> Hibernate comes to save my model class 
>> containing a couple of LocalDateTime attributes, I
>> get an exception:
>>
>> "no instant converter found for type:
>> org.joda.time.LocalDateTime".  
>>
>> I can provide the full stack trace if required.
>>
>> My model class has its LocalDateTime attributes
>> defined the along the lines of the following:
>>
>> LocalDateTime arrivalDateTime;
>>
>> @Type(type="JodaLocalDateTime")
>> @Column(name="arrival_date_time")
>> LocalDateTime getArrivalDateTime() {
>>     return arrivalDateTime;
>> }
>>
>> In my model package, I have the following in
>> "package-info.java":
>>
>> @TypeDefs {
>>     @TypeDef(name = "JodaLocalDateTime", typeClass =
>> PersistentDateTime.class)
>> }
>>
>> My DB has been built via Hibernate + Maven using the
>> hibernate3:hbm2ddl task and the columns created for
>> my LocalDateTime 
>> attributes were given the "Timestamp without
>> timezone" type which seems correct to me.
>>
>> >From my reading of the Joda Time JavaDoc, a
>> LocalDateTime class should be persisted using a
>> "partial" converter rather than the 
>> "instant" converter that is being selected. 
>> However, I'm not sure how to get it to choose the
>> right converter.
>>
>> I suspect that I'm doing something fundamentally
>> wrong here, can someone point out what it is?
>>     

Cheers,
Rob Hills
Waikiki, Western Australia


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to