public List<Properties> get3rdAddrNameList() {
    List<Properties> ret = new ArrayList<Properties>();

    List<Billing3rdPartyAddress> results = dao.findAll();
    Collections.sort(results, Billing3rdPartyAddress.COMPANY_NAME_COMPARATOR);
    for (Billing3rdPartyAddress result : results) {
      Properties prop = new Properties();
      prop.setProperty("id", result.getId().toString());
      prop.setProperty("company_name", result.getCompanyName());
      ret.add(prop);
    }
    return ret;
  }
  // 3rd bill ins. address
  public int addOne3rdAddrRecord(Properties val) {
    Billing3rdPartyAddress b = new Billing3rdPartyAddress();
    b.setAttention(StringEscapeUtils.escapeSql(val.getProperty("attention", "")));
    b.setCompanyName(StringEscapeUtils.escapeSql(val.getProperty("company_name", "")));
    b.setAddress(StringEscapeUtils.escapeSql(val.getProperty("address", "")));
    b.setCity(StringEscapeUtils.escapeSql(val.getProperty("city", "")));
    b.setProvince(StringEscapeUtils.escapeSql(val.getProperty("province", "")));
    b.setPostalCode(StringEscapeUtils.escapeSql(val.getProperty("postcode", "")));
    b.setTelephone(StringEscapeUtils.escapeSql(val.getProperty("telephone", "")));
    b.setFax(StringEscapeUtils.escapeSql(val.getProperty("fax", "")));

    dao.persist(b);

    return b.getId();
  }
 public Properties get3rdAddrProp(String name) {
   Properties prop = new Properties();
   List<Billing3rdPartyAddress> results = dao.findByCompanyName(name);
   for (Billing3rdPartyAddress b : results) {
     prop.setProperty("id", b.getId().toString());
     prop.setProperty("attention", b.getAttention());
     prop.setProperty("company_name", b.getCompanyName());
     prop.setProperty("address", b.getAddress());
     prop.setProperty("city", b.getCity());
     prop.setProperty("province", b.getProvince());
     prop.setProperty("postcode", b.getPostalCode());
     prop.setProperty("telephone", b.getTelephone());
     prop.setProperty("fax", b.getFax());
   }
   return prop;
 }
 public boolean update3rdAddr(String id, Properties val) {
   Billing3rdPartyAddress b = dao.find(Integer.parseInt(id));
   if (b != null) {
     b.setAttention(val.getProperty("attention", ""));
     b.setCompanyName(val.getProperty("company_name", ""));
     b.setAddress(val.getProperty("address", ""));
     b.setCity(val.getProperty("city", ""));
     b.setProvince(val.getProperty("province", ""));
     b.setPostalCode(val.getProperty("postcode", ""));
     b.setTelephone(val.getProperty("telephone", ""));
     b.setFax(val.getProperty("fax", ""));
     dao.merge(b);
     return true;
   }
   return false;
 }
  public Properties get3rdAddr(String id) {
    Properties prop = new Properties();
    Billing3rdPartyAddress b = dao.find(Integer.parseInt(id));
    if (b != null) {
      prop.setProperty("id", id);
      prop.setProperty("attention", b.getAttention());
      prop.setProperty("company_name", b.getCompanyName());
      prop.setProperty("address", b.getAddress());
      prop.setProperty("city", b.getCity());
      prop.setProperty("province", b.getProvince());
      prop.setProperty("postcode", b.getPostalCode());
      prop.setProperty("telephone", b.getTelephone());
      prop.setProperty("fax", b.getFax());
    }

    return prop;
  }