Olá
Estou com esse Erro e já revisei o código mil vezes e não consigo ver onde estou errado.
4.0.0 br.com.alura loja 0.0.1-SNAPSHOT
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.27.Final</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.200</version>
</dependency>
</dependencies>
<persistence-unit name="loja" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="javax.persistence.jbdc.driver" value="org.h2.Driver"/>
<property name="javax.persistence.jbdc.url" value="jdbc:h2:mem:loja"/>
<property name="javax.persistence.jbdc.user" value="sa"/>
<property name="javax.persistence.jbdc.password" value=""/>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
package br.com.alura.loja.teste;
import java.math.BigDecimal;
import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence;
import br.com.alura.loja.modelo.Produto;
public class CadastroDeProduto {
public static void main(String[] args) {
Produto celular = new Produto();
celular.setNome("Xiomi Redme");
celular.setDescricao("Muito legal");
celular.setPreco(new BigDecimal("800"));
EntityManagerFactory factory = Persistence.createEntityManagerFactory("loja");
EntityManager entityManager = factory.createEntityManager();
entityManager.getTransaction().begin();
entityManager.persist(celular);
entityManager.getTransaction().commit();
entityManager.close();
}
}