Estou com problema no hibernate 3.0, criei minha classe, a parte do xml mas quando vou instancear a classe, da o seguinte erro abaixo:
Classe MarcaDAO
/*
* Created on 02/04/2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package org.jpox.sistema.estoque;
import java.util.List;
import org.hibernate.*;
import org.hibernate.cfg.*;
/**
* @author root
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class MarcaDAO
{
private SessionFactory factory;
Configuration cfg;
/**
*
*/
public MarcaDAO()
{
cfg = new Configuration();
cfg.addResource("Marca.hbm.xml");
cfg.setProperty("hibernate.connection.driver_class", "org.firebirdsql.jdbc.FBDriver");
cfg.setProperty("hibernate.connection.url", "jdbc:firebirdsql:127.0.0.1/3050:/armazem/work/bases/siagem.fdb");
cfg.setProperty("hibernate.connection.username", "SYSDBA");
cfg.setProperty("hibernate.connection.password", "masterkey");
cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.FirebirdDialect");
factory = cfg.buildSessionFactory();
}
public void insert (Marca marca)
{
Session session = factory.openSession();
session.save(marca);
session.flush();
session.close();
}
public java.util.List getList (String condicao)
{
Session session = factory.openSession();
Query qry = session.createQuery(condicao);
List amigos = qry.list();
session.flush();
session.close();
return amigos;
}
public Marca retrieve (String pk)
{
Session session = factory.openSession();
Marca marca = (Marca)session.load(Marca.class, pk);
session.flush();
session.close();
return marca;
}
public void delete (Marca marca)
{
Session session = factory.openSession();
session.delete(marca);
session.flush();
session.close();
}
}
Código utilizado para a instancia
MarcaDAO m = new MarcaDAO();
m.insert(new Marca(23,"Testando o hibernate3"));
Lista de Erros
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apach
e/commons/logging/LogFactory
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:110)
at org.jpox.sistema.estoque.MarcaDAO.<init>(MarcaDAO.java:31)
at org.jpox.sistema.estoque.f_Marca.Cadastrar(f_Marca.java:203)
at org.jpox.sistema.estoque.f_Marca.access$0(f_Marca.java:201)
at org.jpox.sistema.estoque.f_Marca$ButtonHandler.actionPerformed(f_Marca.java:
120)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
20)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
.java:234)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1766)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)