|
Re: [CDO/Hibernate] Date Types [message #989410 is a reply to message #989045] |
Thu, 06 December 2012 06:41 |
|
Hi Christoph,
You must decide which Java type fulfills your requirements best and then wrap it into a custom EDataType. That can be
persisted by CDO. Please note that only the Ecore data types are transfered in binary form over the network. CDO
serializes custom data types as Strings.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 04.12.2012 13:27, schrieb Christoph Keimel:
> Hello
>
> What are your experiences with date types (DATE, TIME, DATETIME) using CDO with the Hibernate store? Are there any
> known best practices?
>
> In my case, I would like to the database columns to be created with the respective types (DATE, TIME, DATETIME). From
> a coding point of view it would probably be the easiest to work with java.util.Date or java.util.Calendar. The model
> should automatically discard unwanted information (i.e. the TIME information for a DATE field).
>
> There are lots of possibilities, including but not limited to:
> - using EDate and setting the column type in the mapping
> - wrapping java.util.Date or java.util.Calendar
> - wrapping Long as in java.util.Date.getTime
> - using XMLGregorianCalendar
>
> Any pointers on how to get started are most welcome :)
>
> Thanks
> Christoph
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO/Hibernate] Date Types [message #989429 is a reply to message #989410] |
Thu, 06 December 2012 08:20 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
He Christoph,
Missed your post... I always use java.util.Date myself as this is best-known for most developers. But Dates are a bit
messy in java, especially if you using time zones. Another option is to store them as longs in the database. But this is
less readable if external tools need to directly access the database.
gr. Martin
On 12/06/2012 07:41 AM, Eike Stepper wrote:
> Hi Christoph,
>
> You must decide which Java type fulfills your requirements best and then wrap it into a custom EDataType. That can be
> persisted by CDO. Please note that only the Ecore data types are transfered in binary form over the network. CDO
> serializes custom data types as Strings.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
> Am 04.12.2012 13:27, schrieb Christoph Keimel:
>> Hello
>>
>> What are your experiences with date types (DATE, TIME, DATETIME) using CDO with the Hibernate store? Are there any
>> known best practices?
>>
>> In my case, I would like to the database columns to be created with the respective types (DATE, TIME, DATETIME). From
>> a coding point of view it would probably be the easiest to work with java.util.Date or java.util.Calendar. The model
>> should automatically discard unwanted information (i.e. the TIME information for a DATE field).
>>
>> There are lots of possibilities, including but not limited to:
>> - using EDate and setting the column type in the mapping
>> - wrapping java.util.Date or java.util.Calendar
>> - wrapping Long as in java.util.Date.getTime
>> - using XMLGregorianCalendar
>>
>> Any pointers on how to get started are most welcome :)
>>
>> Thanks
>> Christoph
>>
>>
>
--
With Regards, Martin Taal
Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
Powered by
FUDForum. Page generated in 0.05247 seconds