KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > mapping > UnionSubclass


1 //$Id: UnionSubclass.java,v 1.7 2005/04/26 06:37:54 oneovthafew Exp $
2
package org.hibernate.mapping;
3
4 import java.util.Iterator JavaDoc;
5
6 import org.hibernate.MappingException;
7 import org.hibernate.engine.Mapping;
8
9 /**
10  * A subclass in a table-per-concrete-class mapping
11  * @author Gavin King
12  */

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 JavaDoc getSynchronizedTables() {
32         return synchronizedTables;
33     }
34     
35     protected Iterator JavaDoc 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 JavaDoc accept(PersistentClassVisitor mv) {
56         return mv.accept(this);
57     }
58 }
59
Popular Tags