1 package org.hibernate.cfg; 3 4 import java.util.Map ; 5 import java.util.HashMap ; 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 18 public class CollectionPropertyHolder implements PropertyHolder { 19 Collection collection; 20 private String path; 21 22 public CollectionPropertyHolder(Collection collection, String path) { 23 this.collection = collection; 24 this.path = path; 25 } 26 27 public String 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 getPath() { 52 return path; 53 } 54 55 public Column[] getOverriddenColumn(String propertyName) { 56 return null; 57 } 58 59 public Map <String , Column[]> mergeOverridenColumns(Map <String , Column[]> localColumnOverride) { 60 return new HashMap <String , Column[]>(); 61 } 62 63 public String getEntityName() { 64 return collection.getOwner().getEntityName(); 65 } 66 } 67 | Popular Tags |