code: private String extractHibernateJpaVendorDatabase(Document doc, Element bean)
      {
          for (Element jpaVendorAdapterProperty : $(bean).children("property").filter(attr("name", "jpaVendorAdapter")).get())
          {
              String propertyRef = $(jpaVendorAdapterProperty).attr("ref");
              if (StringUtils.isNotBlank(propertyRef))
              {
                  // look for the properties referenced by a local bean..
                  for (Element jpaVendorAdapter : findLocalBeanById(doc, propertyRef))
                  {
                      // check attribute on element
                      String propAttrValue = $(jpaVendorAdapter).attr("database");
                      if (StringUtils.isNotBlank(propAttrValue))
                      {
                          return propAttrValue;
                      }
  
                      // now look for the property "dataSource" off of that bean.
                      for (Element p : $(jpaVendorAdapter).children("property").filter(attr("name", "database")).get())
                      {
                          String value = $(p).attr("value");
                          if (StringUtils.isNotBlank(value))
                          {
                              return value;
                          }
                      }
                  }
              }
          }
  
          return null;
      }
docs: /*
  <bean id="jpaVendorAdapter2" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> <property name="dataSource" value="HSQL"/>
  </bean>