Exemplo n.º 1
0
  public static void hydrateEntity(IBaseDao dao, Entity entity) {
    if (dao == null) {
      Logger.getLogger(HydratorUtil.class).error("Missing DAO, cannot hydrate.");
      return;
    }
    if (entity == null) return;

    Map<String, PropertyList> lists = entity.getTypedPropertyLists();
    Set<Entry<String, PropertyList>> entrySet = lists.entrySet();
    for (Entry<String, PropertyList> entry : entrySet) {
      PropertyList list = entry.getValue();
      List<Property> propertyList = list.getProperties();
      dao.initialize(propertyList);
      // set the parent in the property since it is not mapped by hibernate anymore
      for (Property property : propertyList) {
        property.setParent(entity);
      }
    }
  }