use of org.hibernate.mapping.Property in project hibernate-orm by hibernate.
the class AuditedPropertiesReader method createPropertiesGroupMapping.
@SuppressWarnings("unchecked")
private void createPropertiesGroupMapping(Property property) {
final Component component = (Component) property.getValue();
final Iterator<Property> componentProperties = component.getPropertyIterator();
while (componentProperties.hasNext()) {
final Property componentProperty = componentProperties.next();
propertiesGroupMapping.put(componentProperty.getName(), property.getName());
}
}
use of org.hibernate.mapping.Property in project hibernate-orm by hibernate.
the class AuditedPropertiesReader method readPersistentPropertiesAccess.
private void readPersistentPropertiesAccess() {
final Iterator<Property> propertyIter = persistentPropertiesSource.getPropertyIterator();
while (propertyIter.hasNext()) {
final Property property = propertyIter.next();
addPersistentProperty(property);
// See HHH-6636
if ("embedded".equals(property.getPropertyAccessorName()) && !PropertyPath.IDENTIFIER_MAPPER_PROPERTY.equals(property.getName())) {
createPropertiesGroupMapping(property);
}
}
}
use of org.hibernate.mapping.Property in project hibernate-orm by hibernate.
the class Java8DateTimeTests method dump.
private void dump(PersistentClass entityBinding, TheEntity theEntity) {
final Iterator propertyBindingIterator = entityBinding.getPropertyClosureIterator();
while (propertyBindingIterator.hasNext()) {
final Property propertyBinding = (Property) propertyBindingIterator.next();
final JavaTypeDescriptor javaTypeDescriptor = ((AbstractStandardBasicType) propertyBinding.getType()).getJavaTypeDescriptor();
System.out.println(String.format("%s (%s) -> %s", propertyBinding.getName(), javaTypeDescriptor.getJavaTypeClass().getSimpleName(), javaTypeDescriptor.toString(propertyBinding.getGetter(TheEntity.class).get(theEntity))));
}
}
use of org.hibernate.mapping.Property in project hibernate-orm by hibernate.
the class ClassesAuditingData method updateCalculatedFields.
/**
* After all meta-data is read, updates calculated fields. This includes:
* <ul>
* <li>setting {@code forceInsertable} to {@code true} for properties specified by {@code @AuditMappedBy}</li>
* <li>adding {@code synthetic} properties to mappedBy relations which have {@code IndexColumn} or {@code OrderColumn}.</li>
* </ul>
*/
public void updateCalculatedFields() {
for (Map.Entry<PersistentClass, ClassAuditingData> classAuditingDataEntry : persistentClassToAuditingData.entrySet()) {
final PersistentClass pc = classAuditingDataEntry.getKey();
final ClassAuditingData classAuditingData = classAuditingDataEntry.getValue();
for (String propertyName : classAuditingData.getNonSyntheticPropertyNames()) {
final Property property = pc.getProperty(propertyName);
updateCalculatedProperty(pc.getEntityName(), property, propertyName, classAuditingData);
}
}
}
use of org.hibernate.mapping.Property in project hibernate-orm by hibernate.
the class UnversionedOptimisticLockingField method testMapping.
@Test
public void testMapping() {
PersistentClass pc = metadata().getEntityBinding(UnversionedOptimisticLockingFieldEntity.class.getName() + "_AUD");
Iterator pi = pc.getPropertyIterator();
while (pi.hasNext()) {
Property p = (Property) pi.next();
assert !"optLocking".equals(p.getName());
}
}
Aggregations