Search in sources :

Example 16 with PropertyData

use of org.hibernate.envers.internal.entities.PropertyData in project hibernate-orm by hibernate.

the class BasicMetadataGenerator method addManyToOne.

@SuppressWarnings({ "unchecked" })
boolean addManyToOne(Element parent, PropertyAuditingData propertyAuditingData, Value value, SimpleMapperBuilder mapper) {
    final Type type = value.getType();
    // A null mapper occurs when adding to composite-id element
    final Element manyToOneElement = parent.addElement(mapper != null ? "many-to-one" : "key-many-to-one");
    manyToOneElement.addAttribute("name", propertyAuditingData.getName());
    manyToOneElement.addAttribute("class", type.getName());
    // schema and the base table schema when a @ManyToOne is present in an identifier.
    if (mapper == null) {
        manyToOneElement.addAttribute("foreign-key", "none");
    }
    MetadataTools.addColumns(manyToOneElement, value.getColumnIterator());
    // A null mapper means that we only want to add xml mappings
    if (mapper != null) {
        final PropertyData propertyData = propertyAuditingData.resolvePropertyData(value.getType());
        mapper.add(propertyData);
    }
    return true;
}
Also used : BasicType(org.hibernate.type.BasicType) CustomType(org.hibernate.type.CustomType) EnumType(org.hibernate.type.EnumType) Type(org.hibernate.type.Type) PropertyData(org.hibernate.envers.internal.entities.PropertyData) Element(org.dom4j.Element)

Aggregations

PropertyData (org.hibernate.envers.internal.entities.PropertyData)16 Map (java.util.Map)6 ToOneIdMapper (org.hibernate.envers.internal.entities.mapper.relation.ToOneIdMapper)5 IdMappingData (org.hibernate.envers.internal.entities.IdMappingData)4 IdMapper (org.hibernate.envers.internal.entities.mapper.id.IdMapper)4 Element (org.dom4j.Element)3 OneToOne (org.hibernate.mapping.OneToOne)3 MappingException (org.hibernate.MappingException)2 MultiPropertyMapper (org.hibernate.envers.internal.entities.mapper.MultiPropertyMapper)2 PropertyMapper (org.hibernate.envers.internal.entities.mapper.PropertyMapper)2 ToOne (org.hibernate.mapping.ToOne)2 Getter (org.hibernate.property.access.spi.Getter)2 BasicType (org.hibernate.type.BasicType)2 Type (org.hibernate.type.Type)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1 Column (javax.persistence.Column)1 XClass (org.hibernate.annotations.common.reflection.XClass)1 XProperty (org.hibernate.annotations.common.reflection.XProperty)1