List of usage examples for org.hibernate.mapping PersistentClass getReferencedProperty
public Property getReferencedProperty(String propertyPath) throws MappingException
From source file:com.zutubi.pulse.master.hibernate.MutableConfiguration.java
License:Apache License
public Mapping getMapping() { return new Mapping() { public IdentifierGeneratorFactory getIdentifierGeneratorFactory() { return null; }//from w w w .j a v a 2 s . co m public Type getIdentifierType(String persistentClass) throws MappingException { PersistentClass pc = classes.get(persistentClass); if (pc == null) { throw new MappingException(I18N.format("unknown.persistent.class", persistentClass)); } return pc.getIdentifier().getType(); } public String getIdentifierPropertyName(String persistentClass) throws MappingException { final PersistentClass pc = classes.get(persistentClass); if (pc == null) { throw new MappingException(I18N.format("unknown.persistent.class", persistentClass)); } if (!pc.hasIdentifierProperty()) return null; return pc.getIdentifierProperty().getName(); } public Type getReferencedPropertyType(String persistentClass, String propertyName) throws MappingException { final PersistentClass pc = classes.get(persistentClass); if (pc == null) { throw new MappingException(I18N.format("unknown.persistent.class", persistentClass)); } Property prop = pc.getReferencedProperty(propertyName); if (prop == null) { throw new MappingException( I18N.format("unknown.persistent.class.property", persistentClass + '.' + propertyName)); } return prop.getType(); } }; }
From source file:com.zutubi.pulse.master.transfer.jdbc.HibernateMapping.java
License:Apache License
public Type getReferencedPropertyType(String persistentClass, String propertyName) throws MappingException { final PersistentClass pc = configuration.getClassMapping(persistentClass); if (pc == null) { throw new MappingException("persistent class not known: " + persistentClass); }/*ww w . j av a2s .c o m*/ Property prop = pc.getReferencedProperty(propertyName); if (prop == null) { throw new MappingException("property not known: " + persistentClass + '.' + propertyName); } return prop.getType(); }