Boa noite pesso
al.
Tenho um projeto maven e não consigo gerar tabelas no banco postgres, estou usando maven e hibernate e o arquivip hibernate.cfg.xml
segue meu xml
`
<!-- resource local - na mesma máquina / JTA - em máquinas diferentes -->
<persistence-unit name="primefaces" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
<property name= "hibernate.connection.url" value= "jdbc:postgresql://localhost:5432/drogaria1" />
<property name="hibernate.connection.username" value="postgres" />
<property name="hibernate.connection.password" value="admin" />
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="hibernate.current_session_context_class"
value="thread" />
</properties>
</persistence-unit>
`
meu hibernate util
`package br.com.isael.drogueiro.util;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
public class HibernateUtil {
private static SessionFactory fabricaDeSessoes = criarFabricaDeSessao();
public static SessionFactory getFabricaDeSessoes() {
return fabricaDeSessoes;
}
private static SessionFactory criarFabricaDeSessao() {
try {
Configuration configuracao = new Configuration().configure();
ServiceRegistry registro = new StandardServiceRegistryBuilder().applySettings(configuracao.getProperties())
.build();
SessionFactory fabrica = configuracao.buildSessionFactory(registro);
return fabrica;
} catch (Throwable ex) {
System.err.println("A fabrica de sessões não pode ser Inciada. " + ex);
throw new ExceptionInInitializerError(ex);
}
}
}
`
a classe teste
`package br.com.isael.drogueiro.util;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
public class HibernateUtil {
private static SessionFactory fabricaDeSessoes = criarFabricaDeSessao();
public static SessionFactory getFabricaDeSessoes() {
return fabricaDeSessoes;
}
private static SessionFactory criarFabricaDeSessao() {
try {
Configuration configuracao = new Configuration().configure();
ServiceRegistry registro = new StandardServiceRegistryBuilder().applySettings(configuracao.getProperties())
.build();
SessionFactory fabrica = configuracao.buildSessionFactory(registro);
return fabrica;
} catch (Throwable ex) {
System.err.println("A fabrica de sessões não pode ser Inciada. " + ex);
throw new ExceptionInInitializerError(ex);
}
}
}
`
e o Stack
`fev 21, 2016 12:10:37 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.1.0.Final}
fev 21, 2016 12:10:37 AM org.hibernate.cfg.Environment
INFO: HHH000206: hibernate.properties not found
fev 21, 2016 12:10:37 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
fev 21, 2016 12:10:38 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager
INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
fev 21, 2016 12:10:38 AM org.hibernate.dialect.Dialect
INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
fev 21, 2016 12:10:38 AM org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl makeLobCreatorBuilder
INFO: HHH000422: Disabling contextual LOB creation as connection was null
fev 21, 2016 12:10:38 AM org.hibernate.type.BasicTypeRegistry register
INFO: HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@4df828d7
fev 21, 2016 12:10:39 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
fev 21, 2016 12:10:39 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [org.postgresql.Driver] at URL [jdbc:postgresql://localhost:5432/drogaria1]
fev 21, 2016 12:10:39 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=postgres, password=****}
fev 21, 2016 12:10:39 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
fev 21, 2016 12:10:39 AM org.hibernate.engine.jdbc.connections.internal.PooledConnections
INFO: HHH000115: Hibernate connection pool size: 1 (min=1)
fev 21, 2016 12:10:40 AM org.hibernate.tool.schema.internal.SchemaCreatorImpl applyImportSources
INFO: HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@52102734’
fev 21, 2016 12:10:40 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop
INFO: HHH10001008: Cleaning up connection pool [jdbc:postgresql://localhost:5432/drogaria1]
`