List of usage examples for org.hibernate.mapping Component getProperty
public Property getProperty(String propertyName) throws MappingException
From source file:net.chrisrichardson.ormunit.hibernate.HibernateMappingTests.java
License:Apache License
private void assertAllFieldsMapped(Component cv, Set fieldsToIgnore) { Set unmappedFields = new HashSet(); Set mappedFields = new HashSet(); for (Iterator it = HibernateAssertUtil.getPersistableFields(cv.getComponentClass(), false).iterator(); it .hasNext();) {//from w w w. j ava 2s.c o m String fieldName = (String) it.next(); try { cv.getProperty(fieldName); mappedFields.add(fieldName); } catch (MappingException e) { unmappedFields.add(fieldName); } } unmappedFields.removeAll(fieldsToIgnore); if (!unmappedFields.isEmpty()) throw new UnmappedFieldsException(cv.getComponentClass(), unmappedFields); Set x = intersection(mappedFields, fieldsToIgnore); if (!x.isEmpty()) { throw new NonPersistentFieldException(cv.getComponentClass(), x); } }
From source file:org.beangle.orm.hibernate.tool.DdlGenerator.java
License:Open Source License
/** * get component class by component property string * //w ww .java 2 s .c o m * @param pc * @param propertyString * @return */ private Class<?> getPropertyType(PersistentClass pc, String propertyString) { String[] properties = split(propertyString, '.'); Property p = pc.getProperty(properties[0]); Component cp = ((Component) p.getValue()); int i = 1; for (; i < properties.length; i++) { p = cp.getProperty(properties[i]); cp = ((Component) p.getValue()); } return cp.getComponentClass(); }