• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in Persisting Date and Time  RSS feed

 
Arun Ashok
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried persisting date along with time using java.util.Date Object but EJB is truncating time and persisting only Date. In Database level my column type is Date. Timestamp works fine but it doesn't support my scenario. Can any one help me out in this. Thanks in advance
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun,
Welcome to JavaRanch!

What's wrong with using TimeStamp on the database end? You can always write a converter so your return a java.util.Date to the caller.

Your container is working as expected. Date is supposed to be only Date. TimeStamp is supposed to be both Date and Time.
 
Reza Rahman
author
Ranch Hand
Posts: 580
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun,

It sounds like you are not quite clear about the usage of @Temporal. I would suggest taking a look at a good reference to investigate further. This might help some: http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html#Temporal.

Regards,
Reza
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!