Created
August 26, 2015 06:18
-
-
Save srigalamilitan/2b67dc9cab84df21b47f to your computer and use it in GitHub Desktop.
Hib5Java8DateTime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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