Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » AbstractDateTimeField with Milliseconds
AbstractDateTimeField with Milliseconds [message #1851521] Thu, 07 April 2022 11:14 Go to next message
Faruk Caglar is currently offline Faruk CaglarFriend
Messages: 33
Registered: August 2019
Member
Hi,

we are using a DateTime Field within a form which has its corresponding column in a DB table. We could not figure out, how we can use also milliseconds. If we put current date into this formfield, the milliseconds are still there, but using the SQL.insert the milliseconds will be cut off. Looking at the plain text of the insert statement the value of field looks like

to_date('07.04.2022 12:52:43','dd.mm.yyyy hh24:mi:ss')

There are no milliseconds. Can somebody give a hint how milliseconds can reach the DB table?

Thanks
Re: AbstractDateTimeField with Milliseconds [message #1851522 is a reply to message #1851521] Thu, 07 April 2022 11:24 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 154
Registered: March 2010
Senior Member
Thank you for your post.

What version of scout are you using?
What database type is it? postgres, oracle, db2?

With that info I can quickly help you
Re: AbstractDateTimeField with Milliseconds [message #1851523 is a reply to message #1851522] Thu, 07 April 2022 11:31 Go to previous messageGo to next message
Faruk Caglar is currently offline Faruk CaglarFriend
Messages: 33
Registered: August 2019
Member
I am using Scout 2021.1202-1200 and MariaDB 10.3
Re: AbstractDateTimeField with Milliseconds [message #1851525 is a reply to message #1851523] Thu, 07 April 2022 12:02 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 154
Registered: March 2010
Senior Member
Thanks. One last question, is it the ISqlService and SQL class you are using for database access?
Which implementation for ISqlService for mario db?
Re: AbstractDateTimeField with Milliseconds [message #1851529 is a reply to message #1851525] Thu, 07 April 2022 14:35 Go to previous messageGo to next message
Faruk Caglar is currently offline Faruk CaglarFriend
Messages: 33
Registered: August 2019
Member
We are using
<dependency>
<groupId>org.eclipse.scout.rt</groupId>
<artifactId>org.eclipse.scout.rt.server.jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
</dependency>
Re: AbstractDateTimeField with Milliseconds [message #1851548 is a reply to message #1851529] Fri, 08 April 2022 07:53 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 154
Registered: March 2010
Senior Member
Thanks.
Date/Time parsing is in DateField.js
The format used is in the (DateTimeField)getConfiguredFormat() method that you (could) overwrite.

But the main caveat may be here:
MySql (same witrh oracle and postgres) use baseic JDBC specification which in turn uses the standard java.sql.Timestamp class to transfer datetime values between the database and the java code.
The java.sql.Timestamp class only uses precision up to second. It contains a seperate field for nanos but this field is not so far supported by database implementors.

So if you really need milliseconds in the field then either use a proprietary sql java class for MySql (does that exist?) or switch to the database type for java.lang.Long and store the Date.getTime() UTC millisecond value.

Does this help further?
Re: AbstractDateTimeField with Milliseconds [message #1851560 is a reply to message #1851548] Fri, 08 April 2022 13:12 Go to previous message
Faruk Caglar is currently offline Faruk CaglarFriend
Messages: 33
Registered: August 2019
Member
thanks Ivan. Thank you for the clarification. at least it creates clarity!!!
Previous Topic:Get data for form from database
Next Topic:How can I execute a scout service using a URL
Goto Forum:
  


Current Time: Thu Dec 12 14:17:33 GMT 2024

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

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

Back to the top