Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.