Capturing Date TimeStamp information

Posted on 2011-09-15
Last Modified: 2012-05-12
Hi - We are trying to capture data time stamp information for auditing purposes - our code passes the date as Calendar.getInstance().getTime() which has this information but it always turns up as AM in the DB - the data type we are using is TIMESTAMP(6) and the DB is Oracle - should we be using a different data type ? Thanks
Question by:abuyusuf35
  • 4
  • 2
LVL 86

Expert Comment

ID: 36543013
How are you inserting the timestamp into the db?
LVL 26

Expert Comment

ID: 36543025
you should be sending it as timestamp,

ps.setTimestamp( index, new Timestamp( Calendar.getInstance().getTime() ) ) ;

Author Comment

ID: 36543045
Sorry, forgot to mention we are using hibernate probably we are missing the Timestamp parameter ?
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

LVL 86

Accepted Solution

CEHJ earned 500 total points
ID: 36543072
Check your mapping in Hibernate

Author Comment

ID: 36543085
I think I know what it is - changed the Hibernate type from Date to Timestamp now I see the time in the DB
LVL 86

Expert Comment

ID: 36543146
Good - so it was your mapping, as i said
LVL 86

Expert Comment

ID: 36575322

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now