PropertyHolder parent, MetadataBuildingContext context) { super( path, parent, inferredData.getPropertyClass(), context ); final XProperty embeddedXProperty = inferredData.getProperty(); setCurrentProperty( embeddedXProperty ); this.component = component; this.attributeConversionInfoMap = processAttributeConversions( inferredData.getClassOrElement() );
public String getClassOrElementName() throws MappingException { return wrappedInferredData.getClassOrElementName(); }
public AccessType getDefaultAccess() { return wrappedInferredData.getDefaultAccess(); }
private static PropertyData getUniqueIdPropertyFromBaseClass( PropertyData inferredData, PropertyData baseInferredData, AccessType propertyAccessor, MetadataBuildingContext context) { List<PropertyData> baseClassElements = new ArrayList<>(); XClass baseReturnedClassOrElement = baseInferredData.getClassOrElement(); PropertyContainer propContainer = new PropertyContainer( baseReturnedClassOrElement, inferredData.getPropertyClass(), propertyAccessor ); addElementsOfClass( baseClassElements, propContainer, context ); //Id properties are on top and there is only one return baseClassElements.get( 0 ); }
public static Component createComponent( PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, MetadataBuildingContext context) { Component comp = new Component( context, propertyHolder.getPersistentClass() ); comp.setEmbedded( isComponentEmbedded ); //yuk comp.setTable( propertyHolder.getTable() ); //FIXME shouldn't identifier mapper use getClassOrElementName? Need to be checked. if ( isIdentifierMapper || ( isComponentEmbedded && inferredData.getPropertyName() == null ) ) { comp.setComponentClassName( comp.getOwner().getClassName() ); } else { comp.setComponentClassName( inferredData.getClassOrElementName() ); } return comp; }
String persistentClassName = rootClass.getClassName(); SimpleValue id; final String propertyName = inferredData.getPropertyName(); if ( isComposite ) { id = fillComponent( XProperty property = inferredData.getProperty(); setupComponentTuplizer( property, componentId ); value.setReturnedClassName( inferredData.getTypeName() ); value.setColumns( columns ); value.setPersistentClassName( persistentClassName ); value.setBuildingContext( buildingContext ); value.setType( inferredData.getProperty(), inferredData.getClassOrElement(), persistentClassName, null ); value.setAccessType( propertyAccessor ); id = value.make(); SecondPass secondPass = new IdGeneratorResolverSecondPass( id, inferredData.getProperty(), generatorType, generatorName, BinderHelper.makeIdGenerator( id, inferredData.getProperty(), generatorType, generatorName,
boolean isIdentifierMapper, MetadataBuildingContext buildingContext) { org.hibernate.annotations.Any anyAnn = inferredData.getProperty() .getAnnotation( org.hibernate.annotations.Any.class ); if ( anyAnn == null ) { binder.setName( inferredData.getPropertyName() ); binder.setValue( value ); binder.setUpdatable( columns[0].isUpdatable() ); binder.setAccessType( inferredData.getDefaultAccess() ); binder.setCascade( cascadeStrategy ); Property prop = binder.makeProperty(); propertyHolder.addProperty( prop, columns, inferredData.getDeclaringClass() );
); XClass entityXClass = inferredData.getClassOrElement(); XProperty idXProperty = inferredData.getProperty(); LOG.tracev( "Bind {0} on {1}", ( isComponent ? "@EmbeddedId" : "@Id" ), inferredData.getPropertyName() );
propertyHolder.startingProperty( inferredData.getProperty() ); final XClass xClassProcessed = inferredData.getPropertyClass(); List<PropertyData> classElements = new ArrayList<>(); XClass returnedClassOrElement = inferredData.getClassOrElement(); if ( baseInferredData != null ) { baseClassElements = new ArrayList<>(); baseReturnedClassOrElement = baseInferredData.getClassOrElement(); bindTypeDefs( baseReturnedClassOrElement, buildingContext ); addElementsOfClass( baseClassElements, propContainer, buildingContext ); for ( PropertyData element : baseClassElements ) { orderedBaseClassElements.put( element.getPropertyName(), element ); for ( int i = 0; i < classElements.size(); i++ ) { final PropertyData idClassPropertyData = classElements.get( i ); final PropertyData entityPropertyData = orderedBaseClassElements.get( idClassPropertyData.getPropertyName() ); if ( propertyHolder.isInIdClass() ) { if ( entityPropertyData == null ) { throw new AnnotationException( "Property of @IdClass not found in entity " + baseInferredData.getPropertyClass().getName() + ": " + idClassPropertyData.getPropertyName() ); final boolean hasXToOneAnnotation = entityPropertyData.getProperty() .isAnnotationPresent( ManyToOne.class ) || entityPropertyData.getProperty().isAnnotationPresent( OneToOne.class );
if ( log.isDebugEnabled() ) { log.debug( "Processing annotations of " + propertyHolder.getEntityName() + "." + inferredData.getPropertyName() ); joinColumns = Ejb3JoinColumn.buildJoinColumns( anns, null, entityBinder.getSecondaryTables(), propertyHolder, inferredData.getPropertyName(), mappings ); joinColumns = Ejb3JoinColumn.buildJoinColumns( joinTableAnn.inverseJoinColumns(), null, entityBinder.getSecondaryTables(), propertyHolder, inferredData.getPropertyName(), mappings ); if ( StringHelper.isEmpty( joinTableAnn.name() ) ) { throw new AnnotationException( "JoinTable.name() on a @ToOne association has to be explicit: " + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) ); if ( log.isDebugEnabled() ) { log.debug( "Bind " + ( isComponent ? "@EmbeddedId" : "@Id" ) + " on " + inferredData.getPropertyName() ); log.debug( inferredData.getPropertyName() + " is a version property" ); RootClass rootClass = (RootClass) propertyHolder.getPersistentClass(); boolean lazy = false;
@Override public void addToOneAndIdProperty(XClass entityType, PropertyData property) { if ( propertiesAnnotatedWithIdAndToOne == null ) { propertiesAnnotatedWithIdAndToOne = new HashMap<>(); } Map<String, PropertyData> map = propertiesAnnotatedWithIdAndToOne.get( entityType ); if ( map == null ) { map = new HashMap<>(); propertiesAnnotatedWithIdAndToOne.put( entityType, map ); } map.put( property.getPropertyName(), property ); }
XProperty property = inferredData.getProperty(); setupComponentTuplizer( property, comp ); PropertyBinder binder = new PropertyBinder(); binder.setName( inferredData.getPropertyName() ); binder.setValue( comp ); binder.setProperty( inferredData.getProperty() ); binder.setAccessType( inferredData.getDefaultAccess() ); binder.setEmbedded( isComponentEmbedded ); binder.setHolder( propertyHolder );
context ); final InheritanceState state = inheritanceStatePerClass.get( idPropertyOnBaseClass.getClassOrElement() ); if ( state == null ) { return false; //while it is likely a user error, let's consider it is something that might happen final XProperty property = idPropertyOnBaseClass.getProperty(); return property.isAnnotationPresent( ManyToOne.class ) || property.isAnnotationPresent( OneToOne.class );
AnyMetaDef metaAnnDef = inferredData.getProperty().getAnnotation( AnyMetaDef.class ); bindAnyMetaDefs( inferredData.getProperty(), context ); + StringHelper.qualify( propertyHolder.getPath(), inferredData.getPropertyName() ) ); final String propertyName = inferredData.getPropertyName(); Ejb3Column.checkPropertyConsistency( columns, propertyHolder.getEntityName() + "." + propertyName ); for (Ejb3JoinColumn column : columns) {
public ComponentPropertyHolder( Component component, String path, PropertyData inferredData, PropertyHolder parent, ExtendedMappings mappings ) { super( path, parent, inferredData.getPropertyClass(), mappings ); final XProperty property = inferredData.getProperty(); setCurrentProperty( property ); this.component = component; this.isOrWithinEmbeddedId = parent.isOrWithinEmbeddedId() || ( property != null && ( property.isAnnotationPresent( Id.class ) || property.isAnnotationPresent( EmbeddedId.class ) ) ); }
public XProperty getProperty() { return wrappedInferredData.getProperty(); }
public String getTypeName() throws MappingException { return wrappedInferredData.getTypeName(); }
public XClass getPropertyClass() throws MappingException { return wrappedInferredData.getPropertyClass(); }
public XClass getDeclaringClass() { return wrappedInferredData.getDeclaringClass(); }
public XClass getClassOrElement() throws MappingException { return wrappedInferredData.getClassOrElement(); }