Guest User

Untitled

a guest
May 20th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. /**
  2. *
  3. */
  4. package br.com.dashboard.banco;
  5.  
  6. import org.hibernate.cfg.AnnotationConfiguration;
  7. import org.hibernate.tool.hbm2ddl.SchemaExport;
  8.  
  9. import br.com.dashboard.util.BancosDados;
  10.  
  11. /**
  12. * @author David A. Pitanguy
  13. * @author Rogerio Santos
  14. *
  15. * @since 19/11/2009
  16. */
  17. public class GerarBanco {
  18.  
  19. /**
  20. * Método utilizado para gerar todo o script estrutural do banco.
  21. *
  22. * @param args
  23. */
  24. public static void main(String[] args) {
  25. //cria uma configuração
  26. AnnotationConfiguration configuration = new AnnotationConfiguration();
  27.  
  28. //lê hibernate.cfg.xml por padrão
  29. // configuration.configure();
  30.  
  31. configuration.configure(BancosDados.DASH.getArquivo());
  32.  
  33. SchemaExport se = new SchemaExport(configuration);
  34. //primeiro boolean indica se vc qr imprimir o sql gerado
  35. //segundo boolean indica se vc qr executa-lo
  36. se.create(true, false);
  37.  
  38. }
  39.  
  40. }
Add Comment
Please, Sign In to add comment