Skip to content

Instantly share code, notes, and snippets.

@liutaio
Created June 16, 2018 09:29
Show Gist options
  • Save liutaio/c1fdedb4fdc84ecd466e2ba5171859a2 to your computer and use it in GitHub Desktop.
Save liutaio/c1fdedb4fdc84ecd466e2ba5171859a2 to your computer and use it in GitHub Desktop.
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named clinicahibernate / duvida forum alura
jun 16, 2018 5:26:08 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [
name: clinicahibernate
...]
jun 16, 2018 5:26:08 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.3.1.Final}
jun 16, 2018 5:26:08 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
jun 16, 2018 5:26:09 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.0.3.Final}
jun 16, 2018 5:26:09 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
jun 16, 2018 5:26:09 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/clinicahibernate?createDatabaseIfNotExist=true]
jun 16, 2018 5:26:09 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001001: Connection properties: {user=root, password=****}
jun 16, 2018 5:26:09 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
INFO: HHH10001003: Autocommit mode: false
jun 16, 2018 5:26:10 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>
INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
Sat Jun 16 05:26:10 GMT-03:00 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
jun 16, 2018 5:26:10 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named clinicahibernate
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at br.com.clinica.DAO.Testes.main(Testes.java:22)
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<!-- unidade de persistencia com o nome clinicahibernate-->
<persistence-unit name="clinicahibernate">
<!-- Implementação do JPA, no nosso caso Hibernate -->
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<!-- Aqui são listadas todas as entidades -->
<class>br.com.clinica.modelo.Consulta</class>
<class>br.com.clinica.modelo.Especialidade</class>
<class>br.com.clinica.modelo.Medico</class>
<class>br.com.clinica.modelo.Paciente</class>
<properties>
<!-- Propriedades JDBC -->
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/clinicahibernate?createDatabaseIfNotExist=true" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="lm2574" />
<!-- Configurações específicas do Hibernate -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
public class Testes {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("clinicahibernate");
EntityManager em = emf.createEntityManager();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment