Esempio n. 1
0
  public void delete(Hermes parent) {
    if (!cascadeDelete) return;
    Set<Hermes> objects = (Set<Hermes>) Introspector.get(attributeName, parent);

    if (objects == null) return;
    jointure.delete("parentId=" + parent.getId());
    for (Hermes obj : objects) obj.delete();
  }
Esempio n. 2
0
  public boolean save(Hermes parent) {
    Set<Hermes> set = (Set<Hermes>) Introspector.get(attributeName, parent);

    if (set == null) return true;
    jointure.clear(parent);

    for (Hermes occurence : set) {
      if (!occurence.save()) return false;
      if (!jointure.save(parent.getId(), occurence.getId())) return false;
    }
    return true;
  }