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.mapping.KeyValue; 9 import org.hibernate.mapping.PersistentClass; 10 import org.hibernate.mapping.Property; 11 import org.hibernate.mapping.Table; 12 13 16 public class ClassPropertyHolder implements PropertyHolder { 17 private PersistentClass persistentClass; 18 private Map <String , Column[]> columnOverride; 19 20 public ClassPropertyHolder(PersistentClass persistentClass, Map <String , Column[]> columnOverride) { 21 this.persistentClass = persistentClass; 22 this.columnOverride = columnOverride; 23 } 24 25 public String getPath() { 26 return persistentClass.getEntityName(); 27 } 28 29 public Column[] getOverriddenColumn(String propertyName) { 30 return columnOverride.get(propertyName); 31 } 32 33 public Map <String , Column[]> mergeOverridenColumns(Map <String , Column[]> localColumnOverride) { 34 Map <String , Column[]> merge = new HashMap <String , Column[]>(localColumnOverride); 35 merge.putAll(localColumnOverride); 36 return merge; 37 } 38 39 public String getEntityName() { 40 return persistentClass.getEntityName(); 41 } 42 43 public void addProperty(Property prop) { 44 persistentClass.addProperty(prop); 45 } 46 47 public String getClassName() { 48 return persistentClass.getClassName(); 49 } 50 51 public Table getTable() { 52 return persistentClass.getTable(); 53 } 54 55 public boolean isComponent() { 56 return false; 57 } 58 59 public PersistentClass getPersistentClass() { 60 return persistentClass; 61 } 62 63 public KeyValue getIdentifier() { 64 return persistentClass.getIdentifier(); 65 } 66 } 67 | Popular Tags |