Problemas ao Persistir ArrayList

Pessoal bom dia!!

Estou apanhando para fazer a gravação em banco com o hibernate de um ArrayList. A relação é 1-n, vários item_pedido, para cada pedido.
Preencher o Array tudo bem, mas não estou conseguindo gravar os item_pedido

Metodo de criação do ArrayList:

 public synchronized void CriaPedido(Pedido pedido,
        CarrinhoCompra carrinhoCompra, Correntista cfAux) {
        pedido.setCorrentista(cfAux);
        Status_PedidoFacade statusPedidoFacade = new Status_PedidoFacade();
        pedido.setStatus_pedido(statusPedidoFacade.findByDescricao("aberto"));
        pedido.setValor_total(carrinhoCompra.getValor_total_item());
        ArrayList itemPedido = new ArrayList(); 
        try {
         HibernateUtil.beginTransaction(); 
         Session session = HibernateUtil.currentSession();
         Iterator itensCompra = carrinhoCompra.getItensCompra().iterator();
            while (itensCompra.hasNext()) {
             Item_Pedido item = (Item_Pedido) itensCompra.next();
             itemPedido.add(itensCompra);
             item.setProduto(item.getProduto());
             item.setQuantidade(item.getQuantidade());
             item.setValor_item(item.getValor_item());
             item.setValor_total_item(carrinhoCompra.getValor_total_item());
            }
    }
    catch (Exception e) {
    }
      this.savePedido(pedido);    
      Item_PedidoFacade itemPedidoFacade = new Item_PedidoFacade();
      itemPedidoFacade.criaItem_Pedido((ArrayList) itemPedido);
      HibernateUtil.commitTransaction();
 }
 O Método criaItem_Pedido:
    public String criaItem_Pedido(ArrayList[] itemPedido){
        saveItem_Pedido((ArrayList[]) itemPedido);
            return "item_pedido_criado";
    }
  O método saveItem_Pedido:

public void saveItem_Pedido(ArrayList[] itemPedido) { try{ HibernateUtil.beginTransaction(); Session session = HibernateUtil.currentSession(); for(int i =0; i < itemPedido.length; i++){ session.save((ArrayList[]) itemPedido); HibernateUtil.commitTransaction(); addMessage("Insert Item_Pedido Ok."); } }catch(HibernateException e){ //addMessage("Erro insert Item_Pedido!"); throw e; }finally{HibernateUtil.closeSession();} }

O pedido, grava normalmente, mas ao tentar gravar o item_pedido, me traz o seguinte stackTrace:
2007-09-14 09:57:47,765 [http-8084-Processor23] ERROR com.sun.faces.lifecycle.InvokeApplicationPhase - java.lang.NoSuchMethodError: beans.Item_PedidoFacade.criaItem_Pedido(Ljava/util/ArrayList;)Ljava/lang/String;
javax.faces.el.EvaluationException: java.lang.NoSuchMethodError: beans.Item_PedidoFacade.criaItem_Pedido(Ljava/util/ArrayList;)Ljava/lang/String;
	at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
	at javax.faces.component.UICommand.broadcast(UICommand.java:305)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at util.Filtro.doFilter(Filtro.java:30)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NoSuchMethodError: beans.Item_PedidoFacade.criaItem_Pedido(Ljava/util/ArrayList;)Ljava/lang/String;
	at beans.PedidoFacade.CriaPedido(PedidoFacade.java:96)
	at loja.AppActionListener.processAction(AppActionListener.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
	... 27 more
2007-09-14 09:57:47,781 [http-8084-Processor23] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/svo].[Faces Servlet] - Servlet.service() for servlet Faces Servlet threw exception
javax.faces.el.EvaluationException: java.lang.NoSuchMethodError: beans.Item_PedidoFacade.criaItem_Pedido(Ljava/util/ArrayList;)Ljava/lang/String;
	at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
	at javax.faces.component.UICommand.broadcast(UICommand.java:305)
	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at util.Filtro.doFilter(Filtro.java:30)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NoSuchMethodError: beans.Item_PedidoFacade.criaItem_Pedido(Ljava/util/ArrayList;)Ljava/lang/String;
	at beans.PedidoFacade.CriaPedido(PedidoFacade.java:96)
	at loja.AppActionListener.processAction(AppActionListener.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
	... 27 more

Se puderem me ajudar, agradeço.[/quote]

Opa,

O metodo save não salva vários objetos de uma vez, você tem que salvar item por item.

:okok:

Bom dia Marcos!!

Valeu pela grande ajuda que tem me dado, mas como mudo a essa forma de gravação??

Abraço

Marcos se ajudar, estou colocando a pilha de exceções:

javax.servlet.ServletException: java.lang.ClassCastException: java.util.AbstractList$Itr
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:209)
	util.Filtro.doFilter(Filtro.java:30)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


root cause 

javax.faces.el.EvaluationException: java.lang.ClassCastException: java.util.AbstractList$Itr
	com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
	javax.faces.component.UICommand.broadcast(UICommand.java:305)
	javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
	javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
	com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
	com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
	util.Filtro.doFilter(Filtro.java:30)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)

O que você fez que gera esta exceção? Bom não está dando para saber o onde está gerando este erro de conversão, você poderia postar o código que você acha que está gerando este erro?

:okok:

Seguinte, preencho o ArrayList nesse método:

 public synchronized void CriaPedido(Pedido pedido,
        CarrinhoCompra carrinhoCompra, Correntista cfAux) {
        pedido.setCorrentista(cfAux);
        Status_PedidoFacade statusPedidoFacade = new Status_PedidoFacade();
        pedido.setStatus_pedido(statusPedidoFacade.findByDescricao("aberto"));
        pedido.setValor_total(carrinhoCompra.getValor_total_item());
        ArrayList item_pedido = new ArrayList(); 
      this.savePedido(pedido);    
      Item_PedidoFacade itemPedidoFacade = new Item_PedidoFacade();
        try {
         HibernateUtil.beginTransaction(); 
         Session session = HibernateUtil.currentSession();
         Iterator itensCompra = carrinhoCompra.getItensCompra().iterator();
            while (itensCompra.hasNext()) {
             item_pedido.add(itensCompra);
             Item_Pedido item = (Item_Pedido) itensCompra.next();
             ProdutoFacade produtoFacade = new ProdutoFacade();
             item.setProduto(produtoFacade.findByCodProd(item.getCod_prod()));
             item.setPedido_item(pedido);
             item.setQuantidade(item.getQuantidade());
             item.setValor_item(item.getValor_item());
             item.setValor_total_item(carrinhoCompra.getValor_total_item());
            }
        }
    catch (Exception e) {
    }
      HibernateUtil.commitTransaction();
      itemPedidoFacade.criaItem_Pedido(item_pedido);
 }
Normal, grava o pedido e o itemPedido, produto, e Pedido vão preenchidos para a classe Item_PedidoFacade, que fara a persisencia do item_pedido.
No Item_PedidoFacade:
    public String criaItem_Pedido(ArrayList item_pedido){
        saveItem_Pedido((ArrayList) item_pedido);
        return"item_pedido_criado";
    }

e o Método que faz(faria) a gravação do Item_Pedido:

[code]
public void saveItem_Pedido(AbstractList itemPedido) {
HibernateUtil.beginTransaction();
Session session = HibernateUtil.currentSession();
try{
/* for(int i =0; i < itemPedido.size(); i++){
Item_Pedido itemDoPedido = (Item_Pedido) itemPedido.get(i);
session.save(itemDoPedido);
HibernateUtil.commitTransaction();*/
Iterator i = itemPedido.iterator();
int in = 0;
while(i.hasNext()){

            Object ent = new Object&#40;&#41;;
            ent = i.next&#40;&#41;;
            
            session.save&#40;ent&#41;;

        addMessage&#40;&quot;Insert Item_Pedido Ok.&quot;&#41;;
        &#125;
    &#125;catch&#40;HibernateException e&#41;&#123;throw e/*System.out.println&#40;&quot;erro em destroy&quot;&#41;*/;
    &#125;
&#125;[/code]

Estou usando o AbstractList como uma tentativa de acertar a exceção, mas não resolveu, agora , a exeção é:

2007-09-17 16&#58;43&#58;20,296 &#91;http-8084-Processor25&#93; ERROR com.sun.faces.lifecycle.InvokeApplicationPhase - org.hibernate.MappingException&#58; Unknown entity&#58; java.util.AbstractList$Itr javax.faces.el.EvaluationException&#58; org.hibernate.MappingException&#58; Unknown entity&#58; java.util.AbstractList$Itr at com.sun.faces.el.MethodBindingImpl.invoke&#40;MethodBindingImpl.java&#58;130&#41; at javax.faces.component.UICommand.broadcast&#40;UICommand.java&#58;305&#41; at javax.faces.component.UIViewRoot.broadcastEvents&#40;UIViewRoot.java&#58;267&#41; at javax.faces.component.UIViewRoot.processApplication&#40;UIViewRoot.java&#58;381&#41; at com.sun.faces.lifecycle.InvokeApplicationPhase.execute&#40;InvokeApplicationPhase.java&#58;75&#41; at com.sun.faces.lifecycle.LifecycleImpl.phase&#40;LifecycleImpl.java&#58;200&#41; at com.sun.faces.lifecycle.LifecycleImpl.execute&#40;LifecycleImpl.java&#58;90&#41; at javax.faces.webapp.FacesServlet.service&#40;FacesServlet.java&#58;197&#41; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;252&#41; at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41; at util.Filtro.doFilter&#40;Filtro.java&#58;30&#41; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;202&#41; at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41; at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter&#40;MonitorFilter.java&#58;368&#41; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;202&#41; at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41; at org.apache.catalina.core.StandardWrapperValve.invoke&#40;StandardWrapperValve.java&#58;213&#41; at org.apache.catalina.core.StandardContextValve.invoke&#40;StandardContextValve.java&#58;178&#41; at org.apache.catalina.core.StandardHostValve.invoke&#40;StandardHostValve.java&#58;126&#41; at org.apache.catalina.valves.ErrorReportValve.invoke&#40;ErrorReportValve.java&#58;105&#41; at org.apache.catalina.core.StandardEngineValve.invoke&#40;StandardEngineValve.java&#58;107&#41; at org.apache.catalina.connector.CoyoteAdapter.service&#40;CoyoteAdapter.java&#58;148&#41; at org.apache.coyote.http11.Http11Processor.process&#40;Http11Processor.java&#58;869&#41; at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection&#40;Http11BaseProtocol.java&#58;664&#41; at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket&#40;PoolTcpEndpoint.java&#58;527&#41; at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt&#40;LeaderFollowerWorkerThread.java&#58;80&#41; at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run&#40;ThreadPool.java&#58;684&#41; at java.lang.Thread.run&#40;Thread.java&#58;595&#41; Caused by&#58; org.hibernate.MappingException&#58; Unknown entity&#58; java.util.AbstractList$Itr at org.hibernate.impl.SessionFactoryImpl.getEntityPersister&#40;SessionFactoryImpl.java&#58;548&#41; at org.hibernate.impl.SessionImpl.getEntityPersister&#40;SessionImpl.java&#58;1338&#41; at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId&#40;AbstractSaveEventListener.java&#58;96&#41; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId&#40;DefaultSaveOrUpdateEventListener.java&#58;186&#41; at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId&#40;DefaultSaveEventListener.java&#58;33&#41; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient&#40;DefaultSaveOrUpdateEventListener.java&#58;175&#41; at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate&#40;DefaultSaveEventListener.java&#58;27&#41; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate&#40;DefaultSaveOrUpdateEventListener.java&#58;70&#41; at org.hibernate.impl.SessionImpl.fireSave&#40;SessionImpl.java&#58;535&#41; at org.hibernate.impl.SessionImpl.save&#40;SessionImpl.java&#58;523&#41; at org.hibernate.impl.SessionImpl.save&#40;SessionImpl.java&#58;519&#41; at beans.Item_PedidoFacade.saveItem_Pedido&#40;Item_PedidoFacade.java&#58;48&#41; at beans.Item_PedidoFacade.criaItem_Pedido&#40;Item_PedidoFacade.java&#58;92&#41; at beans.PedidoFacade.CriaPedido&#40;PedidoFacade.java&#58;100&#41; at loja.AppActionListener.processAction&#40;AppActionListener.java&#58;80&#41; at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41; at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41; at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41; at java.lang.reflect.Method.invoke&#40;Method.java&#58;585&#41; at com.sun.faces.el.MethodBindingImpl.invoke&#40;MethodBindingImpl.java&#58;126&#41; ... 27 more 2007-09-17 16&#58;43&#58;24,531 &#91;http-8084-Processor25&#93; ERROR org.apache.catalina.core.ContainerBase.&#91;Catalina&#93;.&#91;localhost&#93;.&#91;/svo&#93;.&#91;Faces Servlet&#93; - Servlet.service&#40;&#41; for servlet Faces Servlet threw exception javax.faces.el.EvaluationException&#58; org.hibernate.MappingException&#58; Unknown entity&#58; java.util.AbstractList$Itr at com.sun.faces.el.MethodBindingImpl.invoke&#40;MethodBindingImpl.java&#58;130&#41; at javax.faces.component.UICommand.broadcast&#40;UICommand.java&#58;305&#41; at javax.faces.component.UIViewRoot.broadcastEvents&#40;UIViewRoot.java&#58;267&#41; at javax.faces.component.UIViewRoot.processApplication&#40;UIViewRoot.java&#58;381&#41; at com.sun.faces.lifecycle.InvokeApplicationPhase.execute&#40;InvokeApplicationPhase.java&#58;75&#41; at com.sun.faces.lifecycle.LifecycleImpl.phase&#40;LifecycleImpl.java&#58;200&#41; at com.sun.faces.lifecycle.LifecycleImpl.execute&#40;LifecycleImpl.java&#58;90&#41; at javax.faces.webapp.FacesServlet.service&#40;FacesServlet.java&#58;197&#41; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;252&#41; at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41; at util.Filtro.doFilter&#40;Filtro.java&#58;30&#41; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;202&#41; at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41; at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter&#40;MonitorFilter.java&#58;368&#41; at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter&#40;ApplicationFilterChain.java&#58;202&#41; at org.apache.catalina.core.ApplicationFilterChain.doFilter&#40;ApplicationFilterChain.java&#58;173&#41; at org.apache.catalina.core.StandardWrapperValve.invoke&#40;StandardWrapperValve.java&#58;213&#41; at org.apache.catalina.core.StandardContextValve.invoke&#40;StandardContextValve.java&#58;178&#41; at org.apache.catalina.core.StandardHostValve.invoke&#40;StandardHostValve.java&#58;126&#41; at org.apache.catalina.valves.ErrorReportValve.invoke&#40;ErrorReportValve.java&#58;105&#41; at org.apache.catalina.core.StandardEngineValve.invoke&#40;StandardEngineValve.java&#58;107&#41; at org.apache.catalina.connector.CoyoteAdapter.service&#40;CoyoteAdapter.java&#58;148&#41; at org.apache.coyote.http11.Http11Processor.process&#40;Http11Processor.java&#58;869&#41; at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection&#40;Http11BaseProtocol.java&#58;664&#41; at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket&#40;PoolTcpEndpoint.java&#58;527&#41; at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt&#40;LeaderFollowerWorkerThread.java&#58;80&#41; at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run&#40;ThreadPool.java&#58;684&#41; at java.lang.Thread.run&#40;Thread.java&#58;595&#41; Caused by&#58; org.hibernate.MappingException&#58; Unknown entity&#58; java.util.AbstractList$Itr at org.hibernate.impl.SessionFactoryImpl.getEntityPersister&#40;SessionFactoryImpl.java&#58;548&#41; at org.hibernate.impl.SessionImpl.getEntityPersister&#40;SessionImpl.java&#58;1338&#41; at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId&#40;AbstractSaveEventListener.java&#58;96&#41; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId&#40;DefaultSaveOrUpdateEventListener.java&#58;186&#41; at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId&#40;DefaultSaveEventListener.java&#58;33&#41; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient&#40;DefaultSaveOrUpdateEventListener.java&#58;175&#41; at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate&#40;DefaultSaveEventListener.java&#58;27&#41; at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate&#40;DefaultSaveOrUpdateEventListener.java&#58;70&#41; at org.hibernate.impl.SessionImpl.fireSave&#40;SessionImpl.java&#58;535&#41; at org.hibernate.impl.SessionImpl.save&#40;SessionImpl.java&#58;523&#41; at org.hibernate.impl.SessionImpl.save&#40;SessionImpl.java&#58;519&#41; at beans.Item_PedidoFacade.saveItem_Pedido&#40;Item_PedidoFacade.java&#58;48&#41; at beans.Item_PedidoFacade.criaItem_Pedido&#40;Item_PedidoFacade.java&#58;92&#41; at beans.PedidoFacade.CriaPedido&#40;PedidoFacade.java&#58;100&#41; at loja.AppActionListener.processAction&#40;AppActionListener.java&#58;80&#41; at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41; at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41; at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41; at java.lang.reflect.Method.invoke&#40;Method.java&#58;585&#41; at com.sun.faces.el.MethodBindingImpl.invoke&#40;MethodBindingImpl.java&#58;126&#41; ... 27 more

      Parece que é erro de mapeamento mas não tenho a menor ideia do que pode ser, em todo caso, o mapeamento do pedido, e item_pedido:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!DOCTYPE hibernate-mapping PUBLIC &quot;-//Hibernate/Hibernate Mapping DTD 3.0//EN&quot;
&quot;http&#58;//hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&quot;&gt;
&lt;!-- 
    Mapping file autogenerated by MyEclipse - Hibernate Tools
--&gt;
&lt;hibernate-mapping&gt;
    &lt;class name=&quot;beans.Pedido&quot; 
           table=&quot;pedido&quot; 
           catalog=&quot;svo2&quot;&gt;
     &lt;id name=&quot;cod_pedido&quot; type=&quot;java.lang.Integer&quot;&gt;
         &lt;column name=&quot;cod_pedido&quot; /&gt;
         &lt;generator class=&quot;native&quot; /&gt;
     &lt;/id&gt;
     &lt;property name=&quot;valor_total&quot; type=&quot;java.lang.Float&quot;&gt;
       &lt;column name=&quot;valor_total&quot; length=&quot;15&quot; /&gt;
     &lt;/property&gt;

     &lt;set name=&quot;item_pedido&quot;
	  inverse=&quot;true&quot;
	  cascade=&quot;all-delete-orphan&quot;&gt;
          &lt;key column=&quot;cod_item_pedido&quot;/&gt;
          &lt;one-to-many class=&quot;beans.Item_Pedido&quot;/&gt;
     &lt;/set&gt;
 
     &lt;!-- coluna cod_corr vai em pedido --&gt;
     
     &lt;many-to-one
        name=&quot;correntista&quot;
        column=&quot;cod_corr&quot;
        class=&quot;beans.Correntista&quot;/&gt;   

     &lt;many-to-one
          name=&quot;status_pedido&quot;
          column=&quot;cod_status&quot;
          class=&quot;beans.Status_Pedido&quot;/&gt;          

     &lt;set name=&quot;entrega_pedido&quot;
	  inverse=&quot;true&quot;&gt;
          &lt;key column=&quot;cod_entrega&quot;/&gt;
          &lt;one-to-many class=&quot;beans.Entrega&quot;/&gt;
     &lt;/set&gt;
          
     &lt;set name=&quot;fatura&quot;
	  inverse=&quot;true&quot;&gt;
          &lt;key column=&quot;cod_pedido&quot;/&gt;
          &lt;one-to-many class=&quot;beans.Fatura&quot;/&gt;
     &lt;/set&gt;      
      
 &lt;/class&gt;
&lt;/hibernate-mapping&gt;


&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!DOCTYPE hibernate-mapping PUBLIC &quot;-//Hibernate/Hibernate Mapping DTD 3.0//EN&quot;
&quot;http&#58;//hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&quot;&gt;
&lt;hibernate-mapping&gt;
    &lt;class name=&quot;beans.Item_Pedido&quot; 
           table=&quot;item_pedido&quot; 
           catalog=&quot;svo2&quot;&gt;
     &lt;id name=&quot;cod_item_pedido&quot; type=&quot;java.lang.Integer&quot;&gt;
         &lt;column name=&quot;cod_item_pedido&quot; /&gt;
         &lt;generator class=&quot;native&quot; /&gt;
     &lt;/id&gt;
     &lt;property name=&quot;quantidade&quot; type=&quot;java.lang.Integer&quot;&gt;
       &lt;column name=&quot;qtde&quot; length=&quot;15&quot; /&gt;
     &lt;/property&gt;
     
     &lt;property name=&quot;valor_total_item&quot; type=&quot;java.lang.Float&quot;&gt;
       &lt;column name=&quot;valor_total_item&quot; length=&quot;15&quot;/&gt;
     &lt;/property&gt;

     &lt;many-to-one
          name=&quot;produto&quot;
          column=&quot;cod_prod&quot;
          class=&quot;beans.Produto&quot;/&gt; 

     &lt;many-to-one
          name=&quot;pedido_item&quot;
          column=&quot;cod_pedido&quot;
          class=&quot;beans.Pedido&quot;/&gt; 
          
          
 &lt;/class&gt;
&lt;/hibernate-mapping&gt;

Valeu

Opa,

Tente usar java.util.List ao invés AbstractList. Se não for usar Annotations, neste caso é melhor usar java.util.Set, porque você tem que declarar um índice para sua lista no xml que determina a posição, e na maioria das vezes sempre gera problemas.

:okok:

Oi Marcos!!

E como faço isso??