1 package org.hibernate.cfg; 3 4 import java.util.HashMap ; 5 import java.util.Map ; 6 import javax.persistence.Column; 7 8 import org.hibernate.mapping.Component; 9 import org.hibernate.mapping.KeyValue; 10 import org.hibernate.mapping.PersistentClass; 11 import org.hibernate.mapping.Property; 12 import org.hibernate.mapping.Table; 13 14 18 public class ComponentPropertyHolder implements PropertyHolder { 19 private Component component; 20 String path; 21 private Map <String , Column[]> columnOverride; 22 23 public String getPath() { 24 return path; 25 } 26 27 public Column[] getOverriddenColumn(String propertyName) { 28 return columnOverride.get(propertyName); 29 } 30 31 public String getEntityName() { 32 return component.getComponentClassName(); 33 } 34 35 public ComponentPropertyHolder(Component component, String path, Map <String , Column[]> columnOverride) { 36 this.component = component; 37 this.path = path; 38 this.columnOverride = columnOverride; 39 } 40 public String getClassName() { 41 return component.getComponentClassName(); 42 } 43 44 public Table getTable() { 45 return component.getTable(); 46 } 47 48 public void addProperty(Property prop) { 49 component.addProperty(prop); 50 } 51 52 public KeyValue getIdentifier() { 53 return component.getOwner().getIdentifier(); 54 } 55 56 public PersistentClass getPersistentClass() { 57 return component.getOwner(); 58 } 59 60 public boolean isComponent() { 61 return true; 62 } 63 64 public Map <String , Column[]> mergeOverridenColumns(Map <String , Column[]> localColumnOverride) { 65 Map <String , Column[]> merge = new HashMap <String , Column[]>(localColumnOverride); 66 merge.putAll(localColumnOverride); 67 return merge; 68 } 69 } 70 | Popular Tags |