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());
}
}
use of org.hibernate.mapping.Property in project hibernate-orm by hibernate.
the class AuditMetadataGenerator method addProperties.
private void addProperties(Element parent, Iterator<Property> properties, CompositeMapperBuilder currentMapper, ClassAuditingData auditingData, String entityName, EntityXmlMappingData xmlMappingData, boolean firstPass) {
while (properties.hasNext()) {
final Property property = properties.next();
final String propertyName = property.getName();
final PropertyAuditingData propertyAuditingData = auditingData.getPropertyAuditingData(propertyName);
if (propertyAuditingData != null) {
// and if so, this eliminates the mapping property as it isn't needed.
if (property instanceof SyntheticProperty) {
if (property.getValue().isAlternateUniqueKey()) {
continue;
}
}
addValue(parent, property.getValue(), currentMapper, entityName, xmlMappingData, propertyAuditingData, isPropertyInsertable(property), firstPass, true);
}
}
}
Aggregations