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 JoinedSubclass extends Subclass implements TableOwner { 14 15 private Table table; 16 private KeyValue key; 17 18 public JoinedSubclass(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 KeyValue getKey() { 32 return key; 33 } 34 35 public void setKey(KeyValue key) { 36 this.key = key; 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 Iterator getReferenceablePropertyIterator() { 52 return getPropertyIterator(); 53 } 54 55 public Object accept(PersistentClassVisitor mv) { 56 return mv.accept(this); 57 } 58 } 59 | Popular Tags |