title: java reflection getFields for private member| accessing object name value dynamically
body: <p>I want to print all of the class's properties with their name and values.  I have used reflection, but <code>getFields</code> give me length of 0.</p>
  
  <pre><code>RateCode getMaxRateCode = instance.getID(Integer.parseInt((HibernateUtil
              .currentSession().createSQLQuery("select max(id) from ratecodes")
              .list().get(0).toString())));
  for (Field f : getMaxRateCode.getClass().getFields()) {
              try {
                  System.out.println(f.getGenericType() + " " + f.getName() + " = "
                          + f.get(getMaxRateCode));
              } catch (IllegalArgumentException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              } catch (IllegalAccessException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  }
  </code></pre>
  
  <p>RateCode.java</p>
  
  <pre><code>    private Integer rateCodeId;
      private String code;       
      private BigDecimal childStay;       
      private DateTime bookingTo;
      private Short minPerson;      
      private Boolean isFreeNightCumulative = false;
      private boolean flat = false;
      private Timestamp modifyTime;
  </code></pre>