EStou tentando filtra um relatorio a dias porem sem sucesso alguem pode ajudar nao apresenta erro mais nao retorna consulta nenhuma
?
Botao do filtro de relatorio
[code]botao1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
RelatorioCliente rep = new RelatorioCliente();
JasperPrint relat;
Cliente f = new Cliente();
try {
f.setData(b.getSelectedDate());
relat = rep.gerarRelatorioCliente();
JasperViewer.viewReport(relat, false);
} catch (Exception e1) {
e1.printStackTrace();
}
//
}
}); [/code]
classe relatoriocliente
[code]import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import Modelo.Cliente;
public class RelatorioCliente
{
Connection con;
private String converteData(Calendar data) {
// TODO Auto-generated method stub
return new SimpleDateFormat("dd/MM/yyyy").format(new Date().getTime());
}
private static EntityManagerFactory fabricaDeEntidades = null;
private static EntityManager gerenciador = null;
public JasperPrint gerarRelatorioCliente()
throws Exception
{
JasperPrint rel=null;
String url = "jdbc:postgresql://localhost:5432/TurmaN40";
try {
Class.forName("org.postgresql.Driver");
} catch(java.lang.ClassNotFoundException e1) {
System.err.print("ClassNotFoundException: ");
System.err.println(e1.getMessage());
}
try {
con = DriverManager.getConnection(url,"postgres", "postgres");
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
}
try { // Connection con = Conexao.criaConexao();
HashMap<String, JasperPrint> map= new HashMap<String, JasperPrint>();
Cliente sb = new Cliente();
map.put("data: " + converteData(sb.getData()) +"\n",rel);
System.out.println("imprimi data"+map);
String arquivoJasper= "C:\\vidracaria\\RelatorioCliente.jasper";
rel=JasperFillManager.fillReport(arquivoJasper,map,con);
con.close();
}
catch (JRException e)
{ e.printStackTrace();
}
return rel;
}
}[/code]
query do relatorio no ireport