am using hibernate to store the data in to database. Oracle version is 10g. when i insert the date value in to Oracle Date field. its taking "dd/mm/yyyy" format. i want that to be "dd/mm/yyyy hh:mm:ss a" like "06/22/2006 11:24:34 PM". In the hibernate pojo field data type is java.sql.date.
i tried "new Timestamp(System.currentTimeMillis())", new Timestamp(new Date().getTime()) etc. please let me know the solution.
I guess you have only played with value date only but have you mapped your db column to java.sql.Timestamp type in your code.
I would recommend that whatever is your data column in database, map it to java.sql.TimeStamp and provide your value as timestamp
Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
Joined: Oct 18, 2003
Thansk for the message. I even tried with the Hibernate mapping n when i changed the property value from "date" to sql timestamp, hibernate is throwing error : cannot find the matches for the type timestamp. I changed the Oracle data type to TIMESTAMP and i had new problem as time is stored as "mm/dd/yyyy 12:00:00:00,000 AM". Time is stored as default 12:00:00 AM and its not right. it is not taking the right time.