1 package org.hibernate.cfg; 3 4 import java.util.Map ; 5 6 import org.hibernate.AssertionFailure; 7 import org.hibernate.MappingException; 8 import org.hibernate.mapping.ManyToOne; 9 import org.hibernate.mapping.Value; 10 11 18 public class FkSecondPass extends SecondPass { 19 private Value value; 20 private Ejb3JoinColumn[] columns; 21 private boolean unique; 22 23 FkSecondPass(Value value, Ejb3JoinColumn[] columns, boolean unique, Mappings mappings) { 24 super(mappings, null); 25 this.value = value; 26 this.columns = columns; 27 this.unique = unique; 28 } 29 30 void doSecondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas) throws MappingException { 31 secondPass(persistentClasses, inheritedMetas); 32 } 33 34 public void secondPass(Map persistentClasses, Map inheritedMetas) throws MappingException { 35 if (value instanceof ManyToOne) { 36 ManyToOne manyToOne = (ManyToOne) value; 37 AnnotationBinder.bindFkSecondPass( 38 (ManyToOne) value, 39 columns, 40 persistentClasses, 41 unique, 42 (ExtendedMappings) mappings 43 ); 44 manyToOne.createPropertyRefConstraints(persistentClasses); 45 } 46 else { 47 throw new AssertionFailure("FkSecondPass for a wrong value type: " + value.getClass().getName() ); 48 } 49 } 50 } 51 | Popular Tags |