KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > cfg > CollectionPropertyHolder


1 //$Id: CollectionPropertyHolder.java,v 1.2 2005/06/20 17:11:00 epbernard Exp $
2
package org.hibernate.cfg;
3
4 import java.util.Map JavaDoc;
5 import java.util.HashMap JavaDoc;
6 import javax.persistence.Column;
7
8 import org.hibernate.AssertionFailure;
9 import org.hibernate.mapping.Collection;
10 import org.hibernate.mapping.KeyValue;
11 import org.hibernate.mapping.PersistentClass;
12 import org.hibernate.mapping.Property;
13 import org.hibernate.mapping.Table;
14
15 /**
16  * @author Emmanuel Bernard
17  */

18 public class CollectionPropertyHolder implements PropertyHolder {
19     Collection collection;
20     private String JavaDoc path;
21
22     public CollectionPropertyHolder(Collection collection, String JavaDoc path) {
23         this.collection = collection;
24         this.path = path;
25     }
26
27     public String JavaDoc getClassName() {
28         throw new AssertionFailure("Collection property holder does not have a class name");
29     }
30
31     public Table getTable() {
32         return collection.getCollectionTable();
33     }
34
35     public void addProperty(Property prop) {
36         throw new AssertionFailure("Cannot add property to a collection");
37     }
38
39     public KeyValue getIdentifier() {
40         throw new AssertionFailure("Identifier collection not yet managed");
41     }
42
43     public PersistentClass getPersistentClass() {
44         return collection.getOwner();
45     }
46
47     public boolean isComponent() {
48         return false;
49     }
50
51     public String JavaDoc getPath() {
52         return path;
53     }
54
55     public Column[] getOverriddenColumn(String JavaDoc propertyName) {
56         return null;
57     }
58
59     public Map JavaDoc<String JavaDoc, Column[]> mergeOverridenColumns(Map JavaDoc<String JavaDoc, Column[]> localColumnOverride) {
60         return new HashMap JavaDoc<String JavaDoc, Column[]>();
61     }
62
63     public String JavaDoc getEntityName() {
64         return collection.getOwner().getEntityName();
65     }
66 }
67
Popular Tags