SHARE
TWEET

Untitled

a guest Aug 14th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class PopulaConta {
  2.       public static void main(String[] args) {
  3.  
  4.             EntityManager manager = new JPAUtil().getEntityManager();
  5.  
  6.             manager.getTransaction().begin();
  7.  
  8.             Conta conta1 = new Conta();
  9.             Conta conta2 = new Conta();
  10.             Conta conta3 = new Conta();
  11.             Conta conta4 = new Conta();
  12.             Conta conta5 = new Conta();
  13.  
  14.             conta1.setBanco("001 - BANCO DO BRASIL");
  15.             conta1.setNumero("16987-8");
  16.             conta1.setAgencia("6543");
  17.             conta1.setTitular("Maria dos Santos");
  18.  
  19.             conta2.setBanco("237 - BANCO BRADESCO");
  20.             conta2.setNumero("86759-1");
  21.             conta2.setAgencia("1745");
  22.             conta2.setTitular("Paulo Roberto Souza");
  23.  
  24.             conta3.setBanco("341 - BANCO ITAU UNIBANCO");
  25.             conta3.setNumero("46346-3");
  26.             conta3.setAgencia("4606");
  27.             conta3.setTitular("Antonio Duraes");
  28.  
  29.             conta4.setBanco("033 - BANCO SANTANDER");
  30.             conta4.setNumero("12345-6");
  31.             conta4.setAgencia("9876");
  32.             conta4.setTitular("Leandra Marques");
  33.  
  34.             conta5.setBanco("104 - CAIXA ECONOMICA FEDERAL");
  35.             conta5.setNumero("98654-3");
  36.             conta5.setAgencia("1234");
  37.             conta5.setTitular("Alexandre Duarte");
  38.  
  39.             // persistindo as contas
  40.             manager.persist(conta1);
  41.             manager.persist(conta2);
  42.             manager.persist(conta3);
  43.             manager.persist(conta4);
  44.             manager.persist(conta5);
  45.  
  46.             manager.getTransaction().commit();
  47.  
  48.             manager.close();
  49.  
  50.         }
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top