r9688 - helma/helma/trunk/src/helma/objectmodel/db
[email protected] Tue, 28 Apr 2009 15:30:29 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090428133029.E87683D0D6@mia> |
Author: hannes
Date: 2009-04-28 15:30:29 +0200 (Tue, 28 Apr 2009)
New Revision: 9688
Modified:
helma/helma/trunk/src/helma/objectmodel/db/Node.java
Log:
Implement setting complex properties on complex relations by deferring the setting of constraints. Fixes a bug reported by Simon Oberhammer on the mailing list: http://groups.google.com/group/helma/browse_frm/thread/8026700caf582560
Details at http://dev.helma.org/trac/helma/changeset/9688
Modified: helma/helma/trunk/src/helma/objectmodel/db/Node.java
===================================================================
--- helma/helma/trunk/src/helma/objectmodel/db/Node.java 2009-04-28 09:25:38 UTC (rev 9687)
+++ helma/helma/trunk/src/helma/objectmodel/db/Node.java 2009-04-28 13:30:29 UTC (rev 9688)
@@ -2273,7 +2273,7 @@
rel = dbmap.getPropertyRelation(propname);
}
- if (rel != null && (rel.countConstraints() > 1 || rel.isComplexReference())) {
+ if (rel != null && state != TRANSIENT && (rel.countConstraints() > 1 || rel.isComplexReference())) {
rel.setConstraints(this, n);
if (rel.isComplexReference()) {
Key key = new MultiKey(n.getDbMapping(), rel.getKeyParts(this));
@@ -2509,13 +2509,14 @@
// check if this property actually needs to be persisted.
Node n = (Node) next.getNodeValue();
+ Relation rel = null;
if (n == null || n == this) {
continue;
}
if (dbmap != null) {
- Relation rel = dbmap.getExactPropertyRelation(next.getName());
+ rel = dbmap.getExactPropertyRelation(next.getName());
if (rel != null && rel.isVirtual() && !rel.needsPersistence()) {
// temporarilly set state to TRANSIENT to avoid loading anything from db
n.setState(TRANSIENT);
@@ -2533,6 +2534,11 @@
}
n.makePersistable();
+
+ if (rel != null && rel.isComplexReference()) {
+ // if this is a complex reference, make binding properties are set
+ rel.setConstraints(this, n);
+ }
}
}
}