Olá galera. Vejam se podem me ajudar:
Tenho a seguinte classe:
package com.kurtphpr.sistema.cliente;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import <a href="http://javax.persistence.Id">javax.persistence.Id</a>;
import javax.persistence.Table;
@Entity
@Table(name=“cliente”)
public class Cliente {
@Id
@GeneratedValue
private Integer id;
private String cpf;
private String email;
private String endereco;
private String nome;
@Column(name="data_cadastro")
private Date dataCadastro;
private float renda;
... getteres and setters
}
e o seguinte hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.password">qwe123</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/sistemavendas</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping class="com.kurtphpr.sistema.cliente.Cliente"/>
</session-factory>
</hibernate-configuration>
quando incluo
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping class="com.kurtphpr.sistema.cliente.Cliente"/>
tenho o seguinte erro:
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread “main” Deu pau!
org.hibernate.MappingException: An AnnotationConfiguration instance is required to use
java.lang.NullPointerException
at Conecta.main(Conecta.java:14)