0
respostas

Não está mais executando mais nenhum código dos exemplos das aulas

Boa noite, após um período sem acompanhar as aulas, resolvi voltar onde parei na aula 2 carregamento preguiçoso e ao rodar o exemplo desta aula ou de outras aulas dá o erro abaixo: alguém sabe o que pode ser?

fev. 11, 2021 1:30:35 AM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation INFO: HHH000204: Processing PersistenceUnitInfo [name: contas] fev. 11, 2021 1:30:36 AM org.hibernate.Version logVersion INFO: HHH000412: Hibernate ORM core version 5.4.26.Final fev. 11, 2021 1:30:36 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final} fev. 11, 2021 1:30:36 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!) fev. 11, 2021 1:30:36 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001005: using driver [com.mysql.cj.jdbc.Driver] at URL [jdbc:mysql://localhost/alura_jpa] fev. 11, 2021 1:30:36 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001001: Connection properties: {password=****, user=root} fev. 11, 2021 1:30:36 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH10001003: Autocommit mode: false fev. 11, 2021 1:30:36 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections INFO: HHH000115: Hibernate connection pool size: 20 (min=1) fev. 11, 2021 1:30:37 AM org.hibernate.dialect.Dialect INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: contas] Unable to build Hibernate SessionFactory at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1336) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1262) at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at br.com.alura.jpa.testes.TestaRelatorioDasMovimentacoes.main(TestaRelatorioDasMovimentacoes.java:16) Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at table: Conta, for columns: [org.hibernate.mapping.Column(movimentacoes)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:499) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:466) at org.hibernate.mapping.Property.isValid(Property.java:227) at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:624) at org.hibernate.mapping.RootClass.validate(RootClass.java:267) at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:354) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:465) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1259) ... 4 more

o código fonte da aula abaixo:

package br.com.alura.jpa.testes;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;

import br.com.alura.jpa.modelo.Conta;

public class TestaRelatorioDasMovimentacoes {

    public static void main(String[] args) {

        EntityManagerFactory emf = Persistence.createEntityManagerFactory("contas");
        EntityManager em = emf.createEntityManager();

        String jpql = "select c from Conta c";
        TypedQuery<Conta> query = em.createQuery(jpql, Conta.class);

        List<Conta> contas = query.getResultList();
        for (Conta conta : contas) {
            System.out.println("Titular: " + conta.getTitular());
            System.out.println("Agencia: " + conta.getAgencia());
            System.out.println("Numero: " + conta.getNumero());
            System.out.println("Movimentacoes: " + conta.getMovimentacoes());
        }

        emf.close();

    }

}