Esse erro aparece quando executo meu projeto. (DeskTop)
javax.persistence.PersistenceException: org.hibernate.MappingException: Repeated column in mapping for entity: Class.ClCefidorto column: HANDLEORTO (should be mapped with insert=“false” update=“false”)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:737)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at DAO.ConexaoSingleton.(ConexaoSingleton.java:23)
at DAO.ConexaoSingleton.getConexao(ConexaoSingleton.java:30)
at DAO.CadastroDAO.ListaPaciente(CadastroDAO.java:28)
at teste.Main.main(Main.java:28)
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: Class.ClCefidorto column: HANDLEORTO (should be mapped with insert=“false” update=“false”)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:652)
at org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:674)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:696)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:450)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:730)
… 7 more
java.lang.NullPointerException
at DAO.CadastroDAO.ListaPaciente(CadastroDAO.java:30)
at teste.Main.main(Main.java:28)
Exception in thread “main” DAO.DAOException: Nao foi possivel consultar Pessoa
at DAO.CadastroDAO.ListaPaciente(CadastroDAO.java:35)
at teste.Main.main(Main.java:28)
Caused by: java.lang.NullPointerException
at DAO.CadastroDAO.ListaPaciente(CadastroDAO.java:30)
… 1 more
Java Result: 1
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws DAOException {
// TODO code application logic here
// Cadastro c = new Cadastro();
// //c.setIdcadastro(1);
// c.setTexto(“Testess”);
// CadastroDAO dao = new CadastroDAO();
CadastroDAO dao = new CadastroDAO();
List pacientes = dao.ListaPaciente();
System.out.println("Lista " + pacientes);
try {
//dao.salvar©;
} catch (Exception ex) {
System.out.println("ERRO " + ex.getMessage());
}
}
}
Classe de conexão
package DAO;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
*
-
@author Rafael
*/
public class ConexaoSingleton {
private static ConexaoSingleton conexao;
private EntityManager manager;
private EntityManagerFactory emf;private ConexaoSingleton() throws Exception{
this.emf = Persistence.createEntityManagerFactory(“testePU”);//banco
this.manager = emf.createEntityManager();}
public static EntityManager getConexao()throws Exception{
try{
if (conexao == null){
conexao = new ConexaoSingleton();
}}catch(Exception ex){ ex.printStackTrace(); return null; } return conexao.manager;
}
}