package br.com.alura.modelo;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import org.hibernate.annotations.Entity;
@Entity
public class Conta {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
private String titular;
private String numero;
private String banco;
private String agencia;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id =id;
}
public String getTitular() {
return titular;
}
public void setTitular(String titular) {
this.titular = titular;
}
public String getNumero() {
return numero;
}
public void setNumero(String numero) {
this.numero = numero;
}
public String getBanco() {
return banco;
}
public void setBanco(String banco) {
this.banco = banco;
}
public String getAgencia () {
return agencia;
}
public void setAgencia (String agencia) {
this.agencia = agencia;
}
}
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>br.com.alura.modelo.Conta</class>
<!--Propriedade do JDBC -->
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost/financas" />
<property name="javax.persistence.jdbc.user" value="root" />
<property name="javax.persistence.jdbc.password" value="123456" />
<!-- 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>
Ja quebrei a cabeça e continua exibindo o erro.
INFO: HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] Exception in thread "main" java.lang.IllegalArgumentException: Unknown entity: br.com.alura.modelo.Conta at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:808) at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:789) at br.com.alura.principal.TesteInserir.main(TesteInserir.java:25)