}
if (res != null) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Contains: "
- + this.getAllRelations().contains(res));
+ LOG.debug("Contains: " + this.getAllRelations().contains(res));
LOG.debug("Nb relations of this before: "
+ this.getAllRelations().size());
}
if (res.isBidirectional()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Nb relations of reverse before: "
- + ((Entity)res.getTo()).getAllRelations().size());
+ + ((Entity) res.getTo()).getAllRelations().size());
}
- ((Entity)res.getTo()).getAllRelations().remove(res.getReverse());
+ ((Entity) res.getTo()).getAllRelations().remove(
+ res.getReverse());
if (LOG.isDebugEnabled()) {
LOG.debug("Nb relations of reverse after: "
- + ((Entity)res.getTo()).getAllRelations().size());
+ + ((Entity) res.getTo()).getAllRelations().size());
}
}
}
return res;
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.splat.dal.bo.kernel.Any#evict()
+ */
+ @Override
+ public void evict() {
+ super.evict();
+ // Evict all attributes of the persistent object
+ Set<Relation> tmpSet = new HashSet<Relation>();
+ tmpSet.addAll(relations);
+ relations.clear();
+ // Evict relations
+ for (Relation rel : tmpSet) {
+ if (rel.isSaved()) { // to avoid recursive evict
+ rel.evict();
+ }
+ relations.add(rel);
+ }
+ }
}
\ No newline at end of file