Ola pessoal!!.. sou novo no JPA, estour precisando de uma ajuda, não estou consseuindo carregar um combobox com os dados do banco; estou utilizando o Hibernate e o banco e postgres…
estava seguindo um exemplo
mais esta dando pal…
a classe que estava tentando executa o
public class ComboBox extends AbstractListModel implements ComboBoxModel {
private ArrayList<Tipo> Lista=new ArrayList();
private List listaIds;
public ComboBox()
{
EntityManagerFactory emf = Persistence.createEntityManagerFactory("LASVEGASPU");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
listaIds= em.createQuery("Select t.tipId from Tipo t ").getResultList();// DA ERRO NESSA LINHA!!..
for(Iterator<Integer> it=listaIds.iterator(); it.hasNext();)
{ Integer elem=it.next();
Lista.add((Tipo)em.createNamedQuery("Tipo.findByTipId").setParameter("tipId",elem).getSingleResult());
}
em.close();
}
public int getSize() {
return Lista.size();
}
public Object getElementAt(int index) {
return Lista.get(index);
}
public void setSelectedItem(Object anItem) {
throw new UnsupportedOperationException("Not supported yet.");
}
public Object getSelectedItem() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
se alguem poder me ajudar ja estou um tempo encima disso…
a msg de erro que aparce e essa:
INFO: Not binding factory to JNDI, no JNDI name configured
07/05/2009 19:05:50 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: 0A000
07/05/2009 19:05:50 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: ERROR: cross-database references are not implemented: "dblasvegas.public.tipo"
Exception occurred during event dispatching:
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:74)
at lib.gui.ComboBox.(ComboBox.java:31)
at Interface.CADASTRO.CProduto.(CProduto.java:37)