A aplicação está rodado, mas não estou conseguindo gerar tabelas automaticamente no MySql.
Sei que a propriedade do hibernate:
create
gerá tabelas automaticamente, mas não sei se minha estrutura de diretórios está correta.
Quero saber se precisa fazer algo mais, pois estou iniciando um projeto JSF e HIBERNATE.
Queria saber onde devem ficar os arquivos ou falta alguma linha nos arquivos de configuração
para gerar tabelas automaticamente.
Este é meu arquivo web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
Este é meu arquivo faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config version="2.1"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">
<application>
<resource-bundle>
<base-name>depto.aop.propriedades.rotulos</base-name>
<var>msgs</var>
</resource-bundle>
<locale-config>
<default-locale>pt_BR</default-locale>
<supported-locale>pt_BR</supported-locale>
<supported-locale>en_US</supported-locale>
</locale-config>
</application>
</faces-config>
Este é meu arquivo hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/db_depto</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.hbm2dll.auto">create</property>
<mapping resource="depto/usuario/Usuario.hbm.xml"/>
<mapping resource="depto/banco/Banco.hbm.xml"/>
<mapping resource="depto/banco/agencia/Agencia.hbm.xml"/>
<mapping resource="depto/endereco/logradouro/Logradouro.hbm.xml"/>
<mapping resource="depto/endereco/logradouro/tipo/Tipo.hbm.xml"/>
<mapping resource="depto/endereco/bairro/Bairro.hbm.xml"/>
<mapping resource="depto/endereco/cep/Cep.hbm.xml"/>
<mapping resource="depto/endereco/cidade/Cidade.hbm.xml"/>
<mapping resource="depto/endereco/pais/Pais.hbm.xml"/>
<mapping resource="depto/endereco/estado/Estado.hbm.xml"/>
<mapping resource="depto/endereco/Endereco.hbm.xml"/>
<mapping resource="depto/endereco/regiao/Regiao.hbm.xml"/>
<mapping resource="depto/endereco/continente/Continente.hbm.xml"/>
<mapping resource="depto/curso/categoria/Categoria.hbm.xml"/>
<mapping resource="depto/curso/cargahoraria/CargaHoraria.hbm.xml"/>
<mapping resource="depto/curso/nome/Nome.hbm.xml"/>
<mapping resource="depto/curso/enfase/Enfase.hbm.xml"/>
<mapping resource="depto/curso/instituicao/Instituicao.hbm.xml"/>
<mapping resource="depto/curso/nivel/Nivel.hbm.xml"/>
<mapping resource="depto/curso/orgaoreconhecimento/OrgaoReconhecimento.hbm.xml"/>
<mapping resource="depto/curso/situacao/Situacao.hbm.xml"/>
<mapping resource="depto/curso/Curso.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/cargo/Cargo.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/centrocusto/CentroCusto.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/departamento/Departamento.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/contrato/Contrato.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/tipoobservacao/TipoObservacao.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/secao/Secao.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/setor/Setor.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/tipoadmissao/TipoAdmissao.hbm.xml"/>
<mapping resource="depto/dadosfuncionais/turno/Turno.hbm.xml"/>
<mapping resource="depto/documento/rg/orgaoemissor/RgOrgaoEmissor.hbm.xml"/>
<mapping resource="depto/documento/certidaomilitar/CertidaoMilitar.hbm.xml"/>
<mapping resource="depto/documento/cnh/Cnh.hbm.xml"/>
<mapping resource="depto/documento/estadocivil/EstadoCivil.hbm.xml"/>
<mapping resource="depto/lingua/Lingua.hbm.xml"/>
<mapping resource="depto/cartorio/Cartorio.hbm.xml"/>
<mapping resource="depto/empresa/representante/Representante.hbm.xml"/>
<mapping resource="depto/empresa/Empresa.hbm.xml"/>
<mapping resource="depto/contador/Contador.hbm.xml"/>
<mapping resource="depto/sindicato/Sindicato.hbm.xml"/>
<mapping resource="depto/funcionario/dependente/Dependente.hbm.xml"/>
<mapping resource="depto/funcionario/Funcionario.hbm.xml"/>
<mapping resource="depto/funcionario/observacao/Observacao.hbm.xml"/>
<mapping resource="depto/funcionario/idioma/Idioma.hbm.xml"/>
</session-factory>
</hibernate-configuration>
