aspose file tools
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

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

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: 1681

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]
It is sorta covered in the JavaRanch Style Guide.
subject: Storring only current time database