private int findLekarzId(int nr_lekarza)
    {
         int id = 0;
        Session session = factory.openSession();
        Transaction tx = null;
        try
        {
         tx = session.beginTransaction();
         Query query = session.createQuery("from lekarze where nr_lekarza = :id ");
         query.setParameter("id", nr_lekarza);
         
         List<lekarze> l = query.list();
         tx.commit();
         for(lekarze p:l)
         {
             id=p.getLekarz_id();
         }
        }
        catch (HibernateException e) {
         if (tx!=null) tx.rollback();
         e.printStackTrace(); 
         Log.log(Level.WARNING, "Blad usuwania pacjenta", e);
         return 0;
        }
        catch(Exception ex)
        {
            Log.log(Level.SEVERE, "Blad usuwania pacjenta, severe", ex);
            return 0;
        }
        finally {
           session.close();  
           return id;
        }           
   
    }//findLekarzId