11.07.2015 Views

Persistência com JPA2 e Hibernate - Inpi

Persistência com JPA2 e Hibernate - Inpi

Persistência com JPA2 e Hibernate - Inpi

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

139 BEAN VALIDATION E HIBERNATE VALIDATOR3 EntityManagerFactory factory =4 Persistence . createEntityManagerFactory (" K21_bean_validation ");5 EntityManager manager = factory . createEntityManager ();67 manager . getTransaction (). begin ();89 Pessoa p = new Pessoa ();1011 manager . persist (p);1213 manager . getTransaction (). <strong>com</strong>mit ();14 manager . close ();15 factory . close ();16 }17 }Código Java C.5: AdicionaPessoa.javaExecute e observe as mensagens no Consolewww.k19.<strong>com</strong>.br 139

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!