Meu banco de dados com hibernete parou de funcionar!

Estava eu fazendo o meu programa no Netbeans com Hibernete e resolvi dar uma “renovada” no programa. Ou seja, comecei
meio que tudo denovo, dando um cntrl c e v e ir limpando um pouco o codigo.
pois bem, nao é que agora o bixo nao funciona?!

O meu .class

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package empresa;

import java.io.Serializable;
//import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

//@Entity
 
public class Empresa implements Serializable {

  // @Id
  // @GeneratedValue(strategy = GenerationType.AUTO)

    private Long id;
    private String cnpj;
    private String nomeresp;
    private String nomeempresa;
    private String endereco;
    private String numero;
    private String complemento;
    private String bairro;
    private String estado;
    private String cep;
    private String telfixo;
    private String celular;
    private String fax;
    private String email;

    public Empresa() {
    }


    /**
     * Gets the id of this Address.
     *
     * @return the id
     */
    public Long getId() {
        return this.id;
    }

    
     *
     * @param id the new id
     */
    public void setId(Long id) {
        this.id = id;
    }


   /**
     * @return the nomeresp
     */
    public String getNomeresp() {
        return nomeresp;
    }

    /**
     * @param nomeresp the nomeresp to set
     */
    public void setNomeresp(String nomeresp) {
        this.nomeresp = nomeresp;
    }
    /**
     * @return the cnpj
     */
    public String getCnpj() {
        return cnpj;
    }

    /**
     * @param cnpj the cnpj to set
     */
    public void setCnpj(String cnpj) {
        this.cnpj = cnpj;
    }

    /**
     * @return the nomeempresa
     */
    public String getNomeempresa() {
        return nomeempresa;
    }

    /**
     * @param nomeempresa the nomeempresa to set
     */
    public void setNomeempresa(String nomeempresa) {
        this.nomeempresa = nomeempresa;
    }
    /**
     * @return the endereco
     */
    public String getEndereco() {
        return endereco;
    }

    /**
     * @param endereco the endereco to set
     */
    public void setEndereco(String endereco) {
        this.endereco = endereco;
    }

    /**
     * @return the numero
     */
    public String getNumero() {
        return numero;
    }

    /**
     * @param numero the numero to set
     */
    public void setNumero(String numero) {
        this.numero = numero;
    }

    /**
     * @return the complemento
     */
    public String getComplemento() {
        return complemento;
    }

    /**
     * @param complemento the complemento to set
     */
    public void setComplemento(String complemento) {
        this.complemento = complemento;
    }

    /**
     * @return the bairro
     */
    public String getBairro() {
        return bairro;
    }

    /**
     * @param bairro the bairro to set
     */
    public void setBairro(String bairro) {
        this.bairro = bairro;
    }

    /**
     * @return the cep
     */
    public String getCep() {
        return cep;
    }

    /**
     * @param cep the cep to set
     */
    public void setCep(String cep) {
        this.cep = cep;
    }

    /**
     * @return the estado
     */
    public String getEstado() {
        return estado;
    }

    /**
     * @param estado the estado to set
     */
    public void setEstado(String estado) {
        this.estado = estado;
    }

    /**
     * @return the telfixo
     */
    public String getTelfixo() {
        return telfixo;
    }

    /**
     * @param telfixo the telfixo to set
     */
    public void setTelfixo(String telfixo) {
        this.telfixo = telfixo;
    }

    /**
     * @return the celular
     */
    public String getCelular() {
        return celular;
    }

    /**
     * @param celular the celular to set
     */
    public void setCelular(String celular) {
        this.celular = celular;
    }

    /**
     * @return the fax
     */
    public String getFax() {
        return fax;
    }

    /**
     * @param fax the fax to set
     */
    public void setFax(String fax) {
        this.fax = fax;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }
}

O meu arquivo aonde ele trabalha com interface grafica:

/*
 * Empresa10View.java
 */

package empresa10;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import java.awt.event.ActionEvent;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * The application's main frame.
 */
public class Empresa10View extends FrameView {

    public Empresa10View(SingleFrameApplication app) {
        super(app);

        initComponents();

      

    private void btt_cadastrolimparActionPerformed(java.awt.event.ActionEvent evt) {

        //limpar os campos produtos e pecas

        txt_pecamarca.setText("");
        txt_pecamodelo.setText("");
        txt_pecaserie.setText("");

        txt_produtomarca.setText("");
        txt_produtomodelo.setText("");
        txt_produtoserie.setText("");
    }

    private void bt_pesquisarcnpjActionPerformed(java.awt.event.ActionEvent evt) {

}

    private void bt_ApagarActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
}

    private void bt_limparActionPerformed(java.awt.event.ActionEvent evt) {

        //limpar o campo empresa

        txt_cnpj.setText("");
        txt_nomeempresa.setText("");
        txt_nomeresp.setText("");
        txt_endereco.setText("");
        txt_numero.setText("");
        txt_complemento.setText("");
        txt_bairro.setText("");
        txt_cep.setText("");
        txt_telfixo.setText("");
        txt_celular.setText("");
        txt_fax.setText("");
        txt_email.setText("");
}

    private void bt_salvarActionPerformed(java.awt.event.ActionEvent evt) {

        //salvar tabela empresa
        Empresa empresa = new Empresa();

        empresa.setCnpj(txt_cnpj.getText());
        empresa.setNomeempresa(txt_nomeempresa.getText());
        empresa.setNomeresp(txt_nomeresp.getText());
        empresa.setEndereco(txt_endereco.getText());
        empresa.setNumero(txt_numero.getText());
        empresa.setComplemento(txt_complemento.getText());
        empresa.setEstado((String) cbb_estado.getSelectedItem());
        empresa.setBairro(txt_bairro.getText());
        empresa.setCep(txt_cep.getText());
        empresa.setTelfixo(txt_telfixo.getText());
        empresa.setCelular(txt_celular.getText());
        empresa.setFax(txt_fax.getText());
        empresa.setEmail(txt_email.getText());

        //salvar tabela produtos
        Produtos produto = new Produtos();

        produto.setProduto(txt_produtoproduto.getText());
        produto.setMarca(txt_produtomarca.getText());
        produto.setModelo(txt_produtomodelo.getText());
        produto.setSerie(txt_produtoserie.getText());

        //salvar tabela pecas
        Pecas peca = new Pecas();

        peca.setPeca(txt_pecapeca.getText());
        peca.setMarca(txt_pecamarca.getText());
        peca.setModelo(txt_pecamodelo.getText());
        peca.setSerie(txt_pecaserie.getText());



        EntityManagerFactory emf = Persistence.createEntityManagerFactory(
                "Empresa1.0PU");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();

        try {
            em.persist(empresa);
            em.persist(produto);
            em.persist(peca);
            em.getTransaction().commit();
        } catch (Exception e) {
            System.out.println(e.getMessage());
            em.getTransaction().rollback();
        } finally {
            em.close();
        }
}

    // Variables declaration - do not modify
    private javax.swing.JButton bt_Apagar;
    private javax.swing.JButton bt_limpar;
    private javax.swing.JButton bt_pesquisarcnpj;
    private javax.swing.JButton bt_ppeca;
    private javax.swing.JButton bt_salvar;
    private javax.swing.JButton btt_cadastrolimpar;
    private javax.swing.JComboBox cbb_estado;
    private javax.swing.JButton jButton2;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JLabel lbl_bairro;
    private javax.swing.JLabel lbl_celular;
    private javax.swing.JLabel lbl_cep;
    private javax.swing.JLabel lbl_cnpj;
    private javax.swing.JLabel lbl_complemento;
    private javax.swing.JLabel lbl_email;
    private javax.swing.JLabel lbl_endereco;
    private javax.swing.JLabel lbl_estado;
    private javax.swing.JLabel lbl_fax;
    private javax.swing.JLabel lbl_nomeempresa;
    private javax.swing.JLabel lbl_nomeresp;
    private javax.swing.JLabel lbl_numero;
    private javax.swing.JLabel lbl_pcnpj;
    private javax.swing.JLabel lbl_pecamarca;
    private javax.swing.JLabel lbl_pecamodelo;
    private javax.swing.JLabel lbl_pecapeca;
    private javax.swing.JLabel lbl_pecaserie;
    private javax.swing.JLabel lbl_pestado;
    private javax.swing.JLabel lbl_ppeca;
    private javax.swing.JLabel lbl_produtomarca;
    private javax.swing.JLabel lbl_produtomodelo;
    private javax.swing.JLabel lbl_produtoproduto;
    private javax.swing.JLabel lbl_produtoserie;
    private javax.swing.JLabel lbl_servico;
    private javax.swing.JLabel lbl_telfixo;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JPanel mainPanel1;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JTabbedPane tbb_cadastro;
    private javax.swing.JTextField txt_bairro;
    private javax.swing.JTextField txt_celular;
    private javax.swing.JTextField txt_cep;
    private javax.swing.JTextField txt_cnpj;
    private javax.swing.JTextField txt_complemento;
    private javax.swing.JTextField txt_email;
    private javax.swing.JTextField txt_endereco;
    private javax.swing.JTextField txt_fax;
    private javax.swing.JTextField txt_nomeempresa;
    private javax.swing.JTextField txt_nomeresp;
    private javax.swing.JTextField txt_numero;
    private javax.swing.JTextField txt_pcnpj;
    private javax.swing.JTextField txt_pecamarca;
    private javax.swing.JTextField txt_pecamodelo;
    private javax.swing.JTextField txt_pecapeca;
    private javax.swing.JTextField txt_pecaserie;
    private javax.swing.JTextField txt_ppeca;
    private javax.swing.JTextField txt_produtomarca;
    private javax.swing.JTextField txt_produtomodelo;
    private javax.swing.JTextField txt_produtoproduto;
    private javax.swing.JTextField txt_produtoserie;
    private javax.swing.JTextField txt_servico;
    private javax.swing.JTextField txt_telfixo;
    // End of variables declaration

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
}

Só que agora ta aparecendo esse erro:

run:
25/03/2009 01:37:39 org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
25/03/2009 01:37:39 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
25/03/2009 01:37:39 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
25/03/2009 01:37:39 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
25/03/2009 01:37:39 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
25/03/2009 01:37:39 org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.3.2.GA
25/03/2009 01:37:40 org.hibernate.cfg.AnnotationConfiguration secondPassCompile
INFO: Hibernate Validator not found: ignoring
25/03/2009 01:37:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
25/03/2009 01:37:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
25/03/2009 01:37:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: true
25/03/2009 01:37:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/postgres
25/03/2009 01:37:40 org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=postgres, password=****, autocommit=true, release_mode=auto}
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: RDBMS: PostgreSQL, version: 8.3.7
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 8.3 JDBC4 with SSL (build 604)
25/03/2009 01:37:40 org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
25/03/2009 01:37:40 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
25/03/2009 01:37:40 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
25/03/2009 01:37:40 org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: enabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory createCacheProvider
INFO: Cache provider: org.hibernate.cache.NoCacheProvider
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
25/03/2009 01:37:40 org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
25/03/2009 01:37:40 org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
25/03/2009 01:37:40 org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
25/03/2009 01:37:40 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: Running hbm2ddl schema update
25/03/2009 01:37:40 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: fetching database metadata
25/03/2009 01:37:40 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: updating schema
25/03/2009 01:37:40 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: schema update complete
Unknown entity: empresa10.Empresa
CONSTRUÍDO COM SUCESSO (tempo total: 5 segundos)

Ele fala que nao achou o entity mas todas as classes estao no mesmo grupo…

Obrigado!

Posta o codigo aonde vc carrega suas entidades :slight_smile:

Ta aqui:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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_1_0.xsd">
  <persistence-unit name="Empresa1.0PU" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>empresa10.Empresa</class>
    <properties>
      <property name="hibernate.connection.username" value="postgres"/>
      <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
      <property name="hibernate.connection.password" value="123456"/>
      <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/postgres"/>
      <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
    </properties>
  </persistence-unit>
</persistence>

Estou iniciando com o hibernate… e me deparei com um parecido com o do colega rw…
O erro que aparece para mim eh:

25/03/2009 19:05:34 org.hibernate.cfg.Environment <clinit> INFO: Hibernate 3.3.1.GA 25/03/2009 19:05:34 org.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found 25/03/2009 19:05:34 org.hibernate.cfg.Environment buildBytecodeProvider INFO: Bytecode provider name : javassist 25/03/2009 19:05:34 org.hibernate.cfg.Environment <clinit> INFO: using JDK 1.4 java.sql.Timestamp handling 25/03/2009 19:05:34 org.hibernate.cfg.Configuration configure INFO: configuring from resource: c:\teste\hibernate.cfg.xml 25/03/2009 19:05:34 org.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: c:\teste\hibernate.cfg.xml org.hibernate.HibernateException: c:\teste\hibernate.cfg.xml not found at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170) at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1439) at org.hibernate.cfg.Configuration.configure(Configuration.java:1461) at br.com.roderlei.auxiliar.HibernateUtility.<clinit>(HibernateUtility.java:11) at br.com.roderlei.guiteste.Teste.main(Teste.java:12) Exception in thread "main" java.lang.NullPointerException at br.com.roderlei.auxiliar.HibernateUtility.getSession(HibernateUtility.java:19) at br.com.roderlei.guiteste.Teste.main(Teste.java:12) Process exited with exit code 1.

O meu arq hibernate.cfg.xml:

<!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.dialect">
                     org.hibernate.dialect.MySQLDialect
           </property>
           <property name="hibernate.connection.driver_class">
                     com.mysql.jdbc.Driver
           </property>
           <property name="hibernate.connection.url">
                     jdbc:mysql://localhost/aplicFin?autoReconnect=true
           </property>
           <property name="hibernate.connection.usuariot">
                     root
           </property>
           <property name="hibernate.connection.senha">
           </property>
           
           <!-- Condiguração do c3p0 -->
           <property name="hibernate.c3p0.max_size">10</property>
           <property name="hibernate.c3p0.min_size">2</property>
           <property name="hibernate.c3p0.timeout">5000</property>
           <property name="hibernate.c3p0.max_statements">10</property>
           <property name="hibernate.c3p0.idle_test_period">3000</property>
           <property name="hibernate.c3p0.acquire_increment">2</property>

           <!-- Configurações de debug -->
           <property name="show_sql">true</property>
           <property name="hibernate.generate_statistics">true</property>
           <property name="hibernate.use_sql_comments">true</property>
           <mapping resource="c:\\teste\\Endereco.hbm.xml"/>
           <mapping resource="c:\\teste\\Cidade.hbm.xml"/>
           <mapping resource="c:\\teste\\Logradouro.hbm.xml"/>
           <mapping resource="c:\\teste\\Pessoa.hbm.xml"/>
           <mapping resource="c:\\teste\\Cliente.hbm.xml"/>
           <mapping resource="c:\\teste\\Colaborador.hbm.xml"/>
           <mapping resource="c:\\teste\\Fornecedor.hbm.xml"/>
    </session-factory>
</hibernate-configuration>

Este aquivo de configuração foi baseado em um tutorial do Mauricio Linhares.
Agradeço desde já o apoio…

Acho que o nome da sua Entity está errado. Está empresa10.Empresa. Acho que é empresa.Empresa.

[quote=rw]O meu .class

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package empresa;

import java.io.Serializable;
//import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

//@Entity
 
public class Empresa implements Serializable {

  // @Id
  // @GeneratedValue(strategy = GenerationType.AUTO)

    private Long id;

[/quote]

bom aparemente o erro esta ai…

remova esses //

que eles são essenciais