Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » teneo - java.util.Date mapped to DATE, time information is lost
teneo - java.util.Date mapped to DATE, time information is lost [message #60996] Sun, 12 November 2006 22:34 Go to next message
Andre Pareis is currently offline Andre PareisFriend
Messages: 113
Registered: July 2009
Senior Member
Hi,

I have attributes of type java.sql.Date in my model. These are mapped to SQL
type DATE (tested in HSQLDB and MySQL) so it loses the time information after
reading back the value.

I have tried it with a java.sql.Timestamp but this was also mapped to DATE and
the time information was lost.

Can you recommend how to map java.util.Date correctly? I would like to use the
java.util.Date type if possible. Only if there is no way how to do it, then I
would fall back to a long or even a formatted string (but those 2 would be
harder to handle on the GUI).

Any suggestions?

Thanks
Andre
Re: teneo - java.util.Date mapped to DATE, time information is lost [message #61020 is a reply to message #60996] Sun, 12 November 2006 23:30 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
As a default Teneo currently adds a temporal annotation to a java.util.date type, the default value
of this temporal annotation is date (other values are time and timestamp). You can override this by
setting a temporal annotation with value timestamp on the efeature (or edatatype). I have no test
case for this yet.

As an extra remark. I think that a default of timestamp is better. I will change it. In the meantime
you can try the temporal annotation.

gr. Martin

Andre Pareis wrote:
> Hi,
>
> I have attributes of type java.sql.Date in my model. These are mapped to
> SQL type DATE (tested in HSQLDB and MySQL) so it loses the time
> information after reading back the value.
>
> I have tried it with a java.sql.Timestamp but this was also mapped to
> DATE and the time information was lost.
>
> Can you recommend how to map java.util.Date correctly? I would like to
> use the java.util.Date type if possible. Only if there is no way how to
> do it, then I would fall back to a long or even a formatted string (but
> those 2 would be harder to handle on the GUI).
>
> Any suggestions?
>
> Thanks
> Andre


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: teneo - java.util.Date mapped to DATE, time information is lost [message #61042 is a reply to message #61020] Sun, 12 November 2006 23:39 Go to previous message
Andre Pareis is currently offline Andre PareisFriend
Messages: 113
Registered: July 2009
Senior Member
Thanks Martin, the @Temporal annotation does it perfectly...

Martin Taal wrote:
> Hi,
> As a default Teneo currently adds a temporal annotation to a
> java.util.date type, the default value of this temporal annotation is
> date (other values are time and timestamp). You can override this by
> setting a temporal annotation with value timestamp on the efeature (or
> edatatype). I have no test case for this yet.
>
> As an extra remark. I think that a default of timestamp is better. I
> will change it. In the meantime you can try the temporal annotation.
>
> gr. Martin
>
> Andre Pareis wrote:
>> Hi,
>>
>> I have attributes of type java.sql.Date in my model. These are mapped
>> to SQL type DATE (tested in HSQLDB and MySQL) so it loses the time
>> information after reading back the value.
>>
>> I have tried it with a java.sql.Timestamp but this was also mapped to
>> DATE and the time information was lost.
>>
>> Can you recommend how to map java.util.Date correctly? I would like to
>> use the java.util.Date type if possible. Only if there is no way how
>> to do it, then I would fall back to a long or even a formatted string
>> (but those 2 would be harder to handle on the GUI).
>>
>> Any suggestions?
>>
>> Thanks
>> Andre
>
>
Re: teneo - java.util.Date mapped to DATE, time information is lost [message #595490 is a reply to message #60996] Sun, 12 November 2006 23:30 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
As a default Teneo currently adds a temporal annotation to a java.util.date type, the default value
of this temporal annotation is date (other values are time and timestamp). You can override this by
setting a temporal annotation with value timestamp on the efeature (or edatatype). I have no test
case for this yet.

As an extra remark. I think that a default of timestamp is better. I will change it. In the meantime
you can try the temporal annotation.

gr. Martin

Andre Pareis wrote:
> Hi,
>
> I have attributes of type java.sql.Date in my model. These are mapped to
> SQL type DATE (tested in HSQLDB and MySQL) so it loses the time
> information after reading back the value.
>
> I have tried it with a java.sql.Timestamp but this was also mapped to
> DATE and the time information was lost.
>
> Can you recommend how to map java.util.Date correctly? I would like to
> use the java.util.Date type if possible. Only if there is no way how to
> do it, then I would fall back to a long or even a formatted string (but
> those 2 would be harder to handle on the GUI).
>
> Any suggestions?
>
> Thanks
> Andre


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: teneo - java.util.Date mapped to DATE, time information is lost [message #595501 is a reply to message #61020] Sun, 12 November 2006 23:39 Go to previous message
Andre Pareis is currently offline Andre PareisFriend
Messages: 113
Registered: July 2009
Senior Member
Thanks Martin, the @Temporal annotation does it perfectly...

Martin Taal wrote:
> Hi,
> As a default Teneo currently adds a temporal annotation to a
> java.util.date type, the default value of this temporal annotation is
> date (other values are time and timestamp). You can override this by
> setting a temporal annotation with value timestamp on the efeature (or
> edatatype). I have no test case for this yet.
>
> As an extra remark. I think that a default of timestamp is better. I
> will change it. In the meantime you can try the temporal annotation.
>
> gr. Martin
>
> Andre Pareis wrote:
>> Hi,
>>
>> I have attributes of type java.sql.Date in my model. These are mapped
>> to SQL type DATE (tested in HSQLDB and MySQL) so it loses the time
>> information after reading back the value.
>>
>> I have tried it with a java.sql.Timestamp but this was also mapped to
>> DATE and the time information was lost.
>>
>> Can you recommend how to map java.util.Date correctly? I would like to
>> use the java.util.Date type if possible. Only if there is no way how
>> to do it, then I would fall back to a long or even a formatted string
>> (but those 2 would be harder to handle on the GUI).
>>
>> Any suggestions?
>>
>> Thanks
>> Andre
>
>
Previous Topic:teneo - java.util.Date mapped to DATE, time information is lost
Next Topic:EODM - POC to extract relationships
Goto Forum:
  


Current Time: Wed Sep 25 00:39:08 GMT 2024

Powered by FUDForum. Page generated in 0.06643 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top