1 package org.hibernate.mapping; 3 4 import java.util.Iterator ; 5 6 import org.hibernate.MappingException; 7 import org.hibernate.engine.Mapping; 8 9 13 public class UnionSubclass extends Subclass implements TableOwner { 14 15 private Table table; 16 private KeyValue key; 17 18 public UnionSubclass(PersistentClass superclass) { 19 super(superclass); 20 } 21 22 public Table getTable() { 23 return table; 24 } 25 26 public void setTable(Table table) { 27 this.table = table; 28 getSuperclass().addSubclassTable(table); 29 } 30 31 public java.util.Set getSynchronizedTables() { 32 return synchronizedTables; 33 } 34 35 protected Iterator getNonDuplicatedPropertyIterator() { 36 return getPropertyClosureIterator(); 37 } 38 39 public void validate(Mapping mapping) throws MappingException { 40 super.validate(mapping); 41 if ( key!=null && !key.isValid(mapping) ) { 42 throw new MappingException( 43 "subclass key mapping has wrong number of columns: " + 44 getEntityName() + 45 " type: " + 46 key.getType().getName() 47 ); 48 } 49 } 50 51 public Table getIdentityTable() { 52 return getTable(); 53 } 54 55 public Object accept(PersistentClassVisitor mv) { 56 return mv.accept(this); 57 } 58 } 59 | Popular Tags |