public static JasperPrint generateBDC(Integer numFacture){
        
        Connection conn=null;
        JasperPrint printBDC=new JasperPrint();
         
                long start =System.currentTimeMillis();
                        
                
                if (numFacture >0){
                    try {

                        Map<String, Object> paramFacture = new HashMap<String, Object>();
                        paramFacture.put("num_commande", numFacture);

                        org.hibernate.Session session=CEFXUtil.getSessionFactory().getCurrentSession();

                        SessionFactoryImplementor sfi = (SessionFactoryImplementor) session.getSessionFactory();
                        ConnectionProvider cp = sfi.getConnectionProvider();
                        conn = cp.getConnection();

                        printBDC = JasperFillManager.fillReport("src/cefx/report/BonDeCommande.jasper", paramFacture, conn);

                        } catch (Exception e) {
                        throw new RuntimeException("Impossible de générer le BDC", e);
                        //  COMMANDE ENREGISTREE MAIS NON IMPRIMEE
                        } finally {
    //                     it's your responsibility to close the connection, don't forget it!
                            if (conn != null) {
                                 try { conn.close(); } catch (Exception e) {}
                            }
                        } 
                }else{
                        try {

                        Map<String, Object> paramFacture = new HashMap<String, Object>();
                      //  paramFacture.put("num_commande", numFacture);

                        org.hibernate.Session session=CEFXUtil.getSessionFactory().getCurrentSession();

                        SessionFactoryImplementor sfi = (SessionFactoryImplementor) session.getSessionFactory();
                        ConnectionProvider cp = sfi.getConnectionProvider();
                        conn = cp.getConnection();

                        printBDC = JasperFillManager.fillReport("src/cefx/report/BonDeCommande_Vide.jasper", paramFacture, conn);

                        } catch (Exception e) {
                        throw new RuntimeException("Impossible de générer le BDC", e);
                        //  COMMANDE ENREGISTREE MAIS NON IMPRIMEE
                        } finally {
    //                     it's your responsibility to close the connection, don't forget it!
                            if (conn != null) {
                                 try { conn.close(); } catch (Exception e) {}
                            }
                        } 
                    
                    
                }
        
        return printBDC;
    }