Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/hibernate/proxy/EntityNotFoundDelegate
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:119)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at modelo.DAO.PessoaFisicaDAO.novoCadastro(PessoaFisicaDAO.java:20)
at controle.ControlePessoaFisica.actionPerformed(ControlePessoaFisica.java:82)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Coloquei as classes no classpath:
ejb3-persistence
hibernate-annotations
hibernate-commons-annotations
hibernate-entitymanager
hibernate-validator
coloquei o persistence.xml dentro da pasta META-INF
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="banco">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>modelo.PessoaFisica</class>
<class>modelo.PessoaJuridica</class>
<class>modelo.Endereco</class>
<class>modelo.Contrato</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.connection.url" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.driver_class" value="jdbc:mysql://localhost/contratos"/>
</properties>
</persistence-unit>
</persistence>
e minha classe de persistencia é a seguinte
public class PessoaFisicaDAO
{
private EntityManagerFactory factory;
private EntityManager manager;
public boolean novoCadastro(PessoaFisica pessoaFisica)
{
factory = Persistence.createEntityManagerFactory("banco");
manager = factory.createEntityManager();
EntityTransaction tx = manager.getTransaction();
tx.begin();
try
{
manager.persist(pessoaFisica);
manager.flush();
manager.clear();
tx.commit();
}
catch (RuntimeException e)
{
tx.rollback();
manager.close();
factory.close();
return false;
}
manager.close();
factory.close();
return true;
}
}
o objeto pessoaFisica tá preenchido certinho