List of usage examples for org.hibernate.tuple.entity EntityMetamodel getTuplizer
public EntityTuplizer getTuplizer()
From source file:org.jboss.tools.hibernate4_0.console.EntityPropertySource.java
License:Open Source License
public Object getPropertyValue(Object id) { Object propertyValue;/*w w w.j av a 2 s .c om*/ if (id.equals(classMetadata.getIdentifierPropertyName())) { propertyValue = classMetadata.getIdentifier(reflectedObject, (SessionImplementor) currentSession); } else { try { propertyValue = classMetadata.getPropertyValue(reflectedObject, (String) id); } catch (HibernateException he) { propertyValue = HibernateConsoleMessages.EntityPropertySource_unable_to_resolve_property; if (classMetadata instanceof AbstractEntityPersister) { AbstractEntityPersister aep = (AbstractEntityPersister) classMetadata; EntityMetamodel emm = aep.getEntityMetamodel(); if (emm != null) { Integer idx = emm.getPropertyIndexOrNull((String) id); if (idx != null) { propertyValue = emm.getTuplizer().getPropertyValue(reflectedObject, idx); } } } } } if (propertyValue instanceof Collection<?>) { CollectionMetadata collectionMetadata = currentSession.getSessionFactory() .getCollectionMetadata(classMetadata.getEntityName() + "." + id); //$NON-NLS-1$ if (collectionMetadata != null) { propertyValue = new CollectionPropertySource((Collection<?>) propertyValue); } } return propertyValue; }