protected Instantiator buildInstantiator(Component component) { if ( component.isEmbedded() && ReflectHelper.isAbstractClass( this.componentClass ) ) { return new ProxiedInstantiator( this.componentClass ); } if ( optimizer == null ) { return new PojoInstantiator( this.componentClass, null ); } else { return new PojoInstantiator( this.componentClass, optimizer.getInstantiationOptimizer() ); } }
String propertyName) { if ( propertyName == null ) { rootEntityDescriptor.setEmbeddedIdentifier( cid.isEmbedded() ); if ( cid.isEmbedded() ) {
@Override public Type getType() throws MappingException { // Resolve the type of the value once and for all as this operation generates a proxy class // for each invocation. // Unfortunately, there's no better way of doing that as none of the classes are immutable and // we can't know for sure the current state of the property or the value. Type localType = type; if ( localType == null ) { synchronized ( this ) { if ( type == null ) { // TODO : temporary initial step towards HHH-1907 final ComponentMetamodel metamodel = new ComponentMetamodel( this, getMetadata().getMetadataBuildingOptions() ); final TypeFactory factory = getMetadata().getTypeConfiguration().getTypeResolver().getTypeFactory(); localType = isEmbedded() ? factory.embeddedComponent( metamodel ) : factory.component( metamodel ); type = localType; } } } return localType; }
private Type buildType() { // TODO : temporary initial step towards HHH-1907 ComponentMetamodel metamodel = new ComponentMetamodel( this ); if ( isEmbedded() ) { return new EmbeddedComponentType( metamodel ); } else { return new ComponentType( metamodel ); } }
@SuppressWarnings("unchecked") private void addSubElement(Property property, ValidatableElement element) { if ( property != null && property.isComposite() && ! property.isBackRef() ) { Component component = (Component) property.getValue(); if ( component.isEmbedded() ) return; PropertyAccessor accessor = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.POJO ); Getter getter = accessor.getGetter( element.clazz, property.getName() ); ClassValidator validator = new ClassValidator( getter.getReturnType() ); ValidatableElement subElement = new ValidatableElement( getter.getReturnType(), validator, getter ); Iterator properties = component.getPropertyIterator(); while ( properties.hasNext() ) { addSubElement( (Property) properties.next(), subElement ); } if ( subElement.getSubElements().size() != 0 || subElement.validator.hasValidationRules() ) { element.addSubElement( subElement ); } } }
protected Instantiator buildInstantiator(Component component) { if ( component.isEmbedded() && ReflectHelper.isAbstractClass( component.getComponentClass() ) ) { return new ProxiedInstantiator( component ); } if ( optimizer == null ) { return new PojoInstantiator( component, null ); } else { return new PojoInstantiator( component, optimizer.getInstantiationOptimizer() ); } }
protected Instantiator buildInstantiator(Component component) { if ( component.isEmbedded() && ReflectHelper.isAbstractClass( component.getComponentClass() ) ) { return new ProxiedInstantiator( component ); } if ( optimizer == null ) { return new PojoInstantiator( component, null ); } else { return new PojoInstantiator( component, optimizer.getInstantiationOptimizer() ); } }
private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { String propertyName = idNode.attributeValue( "name" ); Component id = new Component( mappings, entity ); entity.setIdentifier( id ); bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas ); if ( propertyName == null ) { entity.setEmbeddedIdentifier( id.isEmbedded() ); if ( id.isEmbedded() ) { // todo : what is the implication of this? id.setDynamic( !entity.hasPojoRepresentation() ); /* * Property prop = new Property(); prop.setName("id"); * prop.setPropertyAccessorName("embedded"); prop.setValue(id); * entity.setIdentifierProperty(prop); */ } } else { Property prop = new Property(); prop.setValue( id ); bindProperty( idNode, prop, mappings, inheritedMetas ); entity.setIdentifierProperty( prop ); } makeIdentifier( idNode, id, mappings ); }
private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { String propertyName = idNode.attributeValue( "name" ); Component id = new Component( entity ); entity.setIdentifier( id ); bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas ); if ( propertyName == null ) { entity.setEmbeddedIdentifier( id.isEmbedded() ); if ( id.isEmbedded() ) { // todo : what is the implication of this? id.setDynamic( !entity.hasPojoRepresentation() ); /* * Property prop = new Property(); prop.setName("id"); * prop.setPropertyAccessorName("embedded"); prop.setValue(id); * entity.setIdentifierProperty(prop); */ } } else { Property prop = new Property(); prop.setValue( id ); bindProperty( idNode, prop, mappings, inheritedMetas ); entity.setIdentifierProperty( prop ); } makeIdentifier( idNode, id, mappings ); }
private static void bindCompositeId(Element idNode, RootClass entity, Mappings mappings, java.util.Map inheritedMetas) throws MappingException { String propertyName = idNode.attributeValue( "name" ); Component id = new Component( mappings, entity ); entity.setIdentifier( id ); bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas ); if ( propertyName == null ) { entity.setEmbeddedIdentifier( id.isEmbedded() ); if ( id.isEmbedded() ) { // todo : what is the implication of this? id.setDynamic( !entity.hasPojoRepresentation() ); /* * Property prop = new Property(); prop.setName("id"); * prop.setPropertyAccessorName("embedded"); prop.setValue(id); * entity.setIdentifierProperty(prop); */ } } else { Property prop = new Property(); prop.setValue( id ); bindProperty( idNode, prop, mappings, inheritedMetas ); entity.setIdentifierProperty( prop ); } makeIdentifier( idNode, id, mappings ); }
@SuppressWarnings( "unchecked" ) private void addSubElement(Property property, ValidatableElement element) { if ( property != null && property.isComposite() && !property.isBackRef() ) { Component component = (Component) property.getValue(); if ( component.isEmbedded() ) return; PropertyAccessor accessor = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.POJO ); Getter getter = accessor.getGetter( element.clazz, property.getName() ); ClassValidator validator = new ClassValidator( getter.getReturnType() ); ValidatableElement subElement = new ValidatableElement( getter.getReturnType(), validator, getter ); Iterator properties = component.getPropertyIterator(); while ( properties.hasNext() ) { addSubElement( (Property) properties.next(), subElement ); } if ( subElement.getSubElements().size() != 0 || subElement.validator.hasValidationRules() ) { element.addSubElement( subElement ); } } }
private Type buildType() { // TODO : temporary initial step towards HHH-1907 ComponentMetamodel metamodel = new ComponentMetamodel( this ); if ( isEmbedded() ) { return getMappings().getTypeResolver().getTypeFactory().embeddedComponent( metamodel ); } else { return getMappings().getTypeResolver().getTypeFactory().component( metamodel ); } }
private Type buildType() { // TODO : temporary initial step towards HHH-1907 ComponentMetamodel metamodel = new ComponentMetamodel( this ); if ( isEmbedded() ) { return getMappings().getTypeResolver().getTypeFactory().embeddedComponent( metamodel ); } else { return getMappings().getTypeResolver().getTypeFactory().component( metamodel ); } }
bindCompositeId( idNode, id, entity, propertyName, mappings, inheritedMetas ); if ( propertyName == null ) { entity.setEmbeddedIdentifier( id.isEmbedded() ); if ( id.isEmbedded() ) {
String propertyName) { if ( propertyName == null ) { rootEntityDescriptor.getEntityMappingHierarchy().setEmbeddedIdentifier( cid.isEmbedded() ); if ( cid.isEmbedded() ) {
if ( isEmbedded() ) { return new EmbeddedComponentType( names,
Component component = (Component) identifier; Iterator<?> properties = component.getPropertyIterator(); if (component.isEmbedded()) { while (properties.hasNext()) { handleProperty(entityType, pc.getMappedClass(), (org.hibernate.mapping.Property) properties.next());
Component component = (Component)identifier; Iterator<?> properties = component.getPropertyIterator(); if (component.isEmbedded()) { while (properties.hasNext()) { handleProperty(entityType, pc.getMappedClass(), (org.hibernate.mapping.Property) properties.next());