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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Storring only current time database" Watch "Storring only current time database" New topic
Author

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)?


kunal
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1649
    
    7

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:
http://stackoverflow.com/questions/5732111/jpa-2-0-and-oracle-with-temporaltype-time



[How To Ask Questions][Read before you PM me]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storring only current time database