File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Storring only current time database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Storring only current time database" Watch "Storring only current time database" New topic

Storring only current time database

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
I need to store only current time (HH:mm:ss) in database. I am using hibernate and Oracle as db. What datatype should i use for time in my Bean class?
Also, what datatype should i use in oracle (for table creation)?

Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

Oracle does not have a time only data type. As far as your object is concerned you can use a java.sql.time object or you can use a Date or Calandar object and annotate it with @Temporal(TemporalType.TIME)

For the other part of your problem have a look at this post:

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: Storring only current time database
It's not a secret anymore!