in Uncategorized

JPA @Temporal annotation – hibernate

JPA @Temporal annotation should be used to annotate class attributes of type java.util.Date  and java.util.Calendar in order to specify time precision. Precision can be date, time or datetime where datetime is default.

Here are all examples of the annotation usage

Lets observe SQL create table command


Data saved into the date related columns like this:

  • DATE_ =>2016-07-27
  • DEF_ =>2016-07-27 19:12:45
  • TIME_ =>19:12:45
  • TIMESTAMP_ =>2016-07-27 16:12:45

Happy coding.

Write a Comment