Skip to content

Instantly share code, notes, and snippets.

@srigalamilitan
Created August 26, 2015 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srigalamilitan/2b67dc9cab84df21b47f to your computer and use it in GitHub Desktop.
Save srigalamilitan/2b67dc9cab84df21b47f to your computer and use it in GitHub Desktop.
Hib5Java8DateTime
public static void main(String[] args) {
EntityManager em =PersistenceManager.INSTANCE.getEntityManager();
em.getTransaction().begin();
for (int i = 0; i < 10; i++) {
OrderTransaction order=new OrderTransaction();
order.setOrderProduct("Computer No "+i);
//Date With LocalDate
order.setOrderDate(LocalDate.now());
//Time With LocalTime
order.setOrderTime(LocalTime.now());
//TimeStamp with LocalDateTime
order.setOrderCreated(LocalDateTime.now());
em.persist(order);
}
em.getTransaction().commit();
em.close();
PersistenceManager.INSTANCE.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment