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
This commit is contained in:
		
							parent
							
								
									b0478b020b
								
							
						
					
					
						commit
						3c44bb305d
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -2273,7 +2273,7 @@ public final class Node implements INode, Serializable {
 | 
				
			||||||
            rel = dbmap.getPropertyRelation(propname);
 | 
					            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);
 | 
					            rel.setConstraints(this, n);
 | 
				
			||||||
            if (rel.isComplexReference()) {
 | 
					            if (rel.isComplexReference()) {
 | 
				
			||||||
                Key key = new MultiKey(n.getDbMapping(), rel.getKeyParts(this));
 | 
					                Key key = new MultiKey(n.getDbMapping(), rel.getKeyParts(this));
 | 
				
			||||||
| 
						 | 
					@ -2509,13 +2509,14 @@ public final class Node implements INode, Serializable {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                // check if this property actually needs to be persisted.
 | 
					                // check if this property actually needs to be persisted.
 | 
				
			||||||
                Node n = (Node) next.getNodeValue();
 | 
					                Node n = (Node) next.getNodeValue();
 | 
				
			||||||
 | 
					                Relation rel = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (n == null || n == this) {
 | 
					                if (n == null || n == this) {
 | 
				
			||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (dbmap != null) {
 | 
					                if (dbmap != null) {
 | 
				
			||||||
                    Relation rel = dbmap.getExactPropertyRelation(next.getName());
 | 
					                    rel = dbmap.getExactPropertyRelation(next.getName());
 | 
				
			||||||
                    if (rel != null && rel.isVirtual() && !rel.needsPersistence()) {
 | 
					                    if (rel != null && rel.isVirtual() && !rel.needsPersistence()) {
 | 
				
			||||||
                        // temporarilly set state to TRANSIENT to avoid loading anything from db
 | 
					                        // temporarilly set state to TRANSIENT to avoid loading anything from db
 | 
				
			||||||
                        n.setState(TRANSIENT);
 | 
					                        n.setState(TRANSIENT);
 | 
				
			||||||
| 
						 | 
					@ -2533,6 +2534,11 @@ public final class Node implements INode, Serializable {
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                n.makePersistable();
 | 
					                n.makePersistable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (rel != null && rel.isComplexReference()) {
 | 
				
			||||||
 | 
					                    // if this is a complex reference, make binding properties are set
 | 
				
			||||||
 | 
					                    rel.setConstraints(this, n);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue