Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6330317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:50:57+00:00 2026-05-24T17:50:57+00:00

When I insert a date in my my table using ORMLite I usually do

  • 0

When I insert a date in my my table using ORMLite I usually do something like this:

@DatabaseField(dataType=DataType.DATE_STRING, format="yyyy-MM-dd HH:mm:ss")
private Date MatchDate;

What if I want something like

ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP 

?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:50:58+00:00Added an answer on May 24, 2026 at 5:50 pm

    You can specify the custom SQL to create the field using the @DatabaseField columnDefinition field.

    @DatabaseField(dataType = DataType.DATE_STRING, format = "yyyy-MM-dd HH:mm:ss",
          columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
    private Date MatchDate;
    

    Another option would be to make the schema yourself if you need more control. You can get the create table statements from TableUtils.getCreateTableStatements() method and then you will have to tune them to adjust for the ON UPDATE CURRENT_TIMESTAMP, etc..

    You can execute raw SQL with the dao.executeSql("...") method. Here are the javadocs for this method.

    Here’s a link to the documentation of what raw SQL statements you can execute in ORMLite.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Like: insert into table (col) values (N'multilingual unicode strings') I'm using SQL Server 2008
I'm using now() in MySQL query. INSERT INTO table SET data = '$data', date
I am trying to INSERT INTO a table using the input from another table.
Using SQL Server 2005 When i insert the date it should compare the date
I am trying to insert a record into a table using Linq but get
I have some PHP code that inserts a date into a table: INSERT INTO
I insert into an Oracle DB Table using the following insert string (Approx --
I am trying to insert a row in ms-sql table using the following code
I'm try to insert values into my sqlite table using a python script. It
I am trying to insert a future date into a MySQL table from PHP.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.