javasf@googlegroups.com
[Top] [All Lists]

Re: [javasf] java.lang.NumberFormatException.forInputString

Subject: Re: [javasf] java.lang.NumberFormatException.forInputString
From: eduardo borges
Date: Tue, 23 Mar 2010 01:25:03 -0300
aqui estão as classes:

package br.estudo.bussines;

import java.util.Vector;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import br.estudo.Dao.CreditoDao;
import br.estudo.model.Credito;
import br.estudo.model.Java_Persistence;

public class CreditoDaoImp implements CreditoDao {
protected Java_Persistence javaPersistence=new Java_Persistence();
private EntityManager em;
public CreditoDaoImp(){
em=javaPersistence.getEMF().createEntityManager();
}
    public  void inserir(Credito credito){
     try{
      
        
             
          em.getTransaction().begin();
        em.persist(credito);
      em.getTransaction().commit();
      em.refresh(credito);
       
     }catch(Exception e){
     e.getMessage();
     }
     
    
    }
      public void initEntityManager(){
       em=javaPersistence.getEMF().createEntityManager();
     
//      
    }
       
@SuppressWarnings("unchecked")
public Vector<Credito> listar(){
      
      Query query=em.createNamedQuery("lista");
      
      
      return (Vector<Credito>) query.getResultList();
      }
 
 
}

a classe credito

package br.estudo.model;


import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.NamedNativeQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@SuppressWarnings("serial")
@NamedNativeQuery(name="lista", query="Select * from credito")
@Entity
public class Credito implements Serializable{
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
private Long id;
@Column(nullable = false, name = "empresa")
private String nome_divida;
@Column(nullable = false, name = "quantidade")
private int numero_parcela;
@Column(name = "data_inicial", nullable = false)
@Temporal(TemporalType.DATE)
private Date data_inicial;
@Column(name = "data_final", nullable = false)
@Temporal(TemporalType.DATE)
private Date data_final;
@Column(name="dia_vencimento",nullable=false)
private int dia_vencimento;

public int getDia_vencimento() {
return dia_vencimento;
}

public void setDia_vencimento(int diaVencimento) {
dia_vencimento = diaVencimento;
}

public String getNome_divida() {
return nome_divida;
}

public void setNome_divida(String nomeDivida) {
nome_divida = nomeDivida;
}

public int getNumero_parcela() {
return numero_parcela;
}

public void setNumero_parcela(int numeroParcela) {
numero_parcela = numeroParcela;
}

public Date getData_inicial() {
return data_inicial;
}

public void setData_inicial(Date dataInicial) {
data_inicial = dataInicial;
}

public Date getData_final() {
return data_final;
}

public void setData_final(Date dataFinal) {
data_final = dataFinal;
}
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}
public String toString(){
return "br.estudo.model.Credito[id="+id+"nome_divida="+nome_divida+"data_inicial="+data_inicial+"data_final="+data_final+"numero_parcela="+numero_parcela+"dia_vencimento="+dia_vencimento+"]";
}

}
obrigado pela atenção
Em 22 de março de 2010 10:02, rondinelle pessoa <rondinellepessoa@xxxxxxxxx> escreveu:
Cara me passa o metodo credito e o select que ta trazendo essa lista.

Em 20 de março de 2010 13:11, epontes <duca86@xxxxxxxxx> escreveu:
Olá Amigos,

estou precisando de uma forcinha aqui nesse erro, estou tentando
popular um dataTable com resultado de uma pesquisa no banco de dados,
ou seja, fazendo um select * from tabela... o erro que me aparece é o
java.lang.NumberFormatException.forInputString .... Obrigado pela
atenção!!!


meu código é esse da dataTable.

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
<title>Home</title>
</head>
<body>
<f:view>
       <h:form>
               <h:panelGrid>
                       <h:dataTable var="credit" value="#{Alerta.credito}">

               <h:column>
                                       <h:outputText  value="#{credit.id}">

                   </h:outputText>
                               </h:column>

                       </h:dataTable>
               </h:panelGrid>
       </h:form>
</f:view>
</body>
</html>

--
http://groups.google.com/group/javasf

You received this message because you are subscribed to the Google
Groups "javasf: JavaServer Faces Group" group.
To post to this group, send email to javasf@xxxxxxxxxxxxxxxx

To unsubscribe from this group, send email to javasf+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

--
http://groups.google.com/group/javasf
 
You received this message because you are subscribed to the Google
Groups "javasf: JavaServer Faces Group" group.
To post to this group, send email to javasf@xxxxxxxxxxxxxxxx
 
To unsubscribe from this group, send email to javasf+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.



--
'“As idéias simples só estão ao alcance de espíritos complexos.”

--
http://groups.google.com/group/javasf
 
You received this message because you are subscribed to the Google
Groups "javasf: JavaServer Faces Group" group.
To post to this group, send email to javasf@xxxxxxxxxxxxxxxx
 
To unsubscribe from this group, send email to javasf+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
<Prev in Thread] Current Thread [Next in Thread>