Java Code Examples for org.hibernate.mapping.Component#getComponentClassName()
The following examples show how to use
org.hibernate.mapping.Component#getComponentClassName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationBinder.java From lams with GNU General Public License v2.0 | 4 votes |
private static PropertyBinder bindComponent( PropertyData inferredData, PropertyHolder propertyHolder, AccessType propertyAccessor, EntityBinder entityBinder, boolean isIdentifierMapper, MetadataBuildingContext buildingContext, boolean isComponentEmbedded, boolean isId, //is a identifier Map<XClass, InheritanceState> inheritanceStatePerClass, String referencedEntityName, //is a component who is overridden by a @MapsId Ejb3JoinColumn[] columns) { Component comp; if ( referencedEntityName != null ) { comp = createComponent( propertyHolder, inferredData, isComponentEmbedded, isIdentifierMapper, buildingContext ); SecondPass sp = new CopyIdentifierComponentSecondPass( comp, referencedEntityName, columns, buildingContext ); buildingContext.getMetadataCollector().addSecondPass( sp ); } else { comp = fillComponent( propertyHolder, inferredData, propertyAccessor, !isId, entityBinder, isComponentEmbedded, isIdentifierMapper, false, buildingContext, inheritanceStatePerClass ); } if ( isId ) { comp.setKey( true ); if ( propertyHolder.getPersistentClass().getIdentifier() != null ) { throw new AnnotationException( comp.getComponentClassName() + " must not have @Id properties when used as an @EmbeddedId: " + BinderHelper.getPath( propertyHolder, inferredData ) ); } if ( referencedEntityName == null && comp.getPropertySpan() == 0 ) { throw new AnnotationException( comp.getComponentClassName() + " has no persistent id property: " + BinderHelper.getPath( propertyHolder, inferredData ) ); } } XProperty property = inferredData.getProperty(); setupComponentTuplizer( property, comp ); PropertyBinder binder = new PropertyBinder(); binder.setDeclaringClass(inferredData.getDeclaringClass()); binder.setName( inferredData.getPropertyName() ); binder.setValue( comp ); binder.setProperty( inferredData.getProperty() ); binder.setAccessType( inferredData.getDefaultAccess() ); binder.setEmbedded( isComponentEmbedded ); binder.setHolder( propertyHolder ); binder.setId( isId ); binder.setEntityBinder( entityBinder ); binder.setInheritanceStatePerClass( inheritanceStatePerClass ); binder.setBuildingContext( buildingContext ); binder.makePropertyAndBind(); return binder; }
Example 2
Source File: AttributeFactory.java From lams with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unchecked") private <Y> Type<Y> getMetaModelType(ValueContext typeContext) { switch ( typeContext.getValueClassification() ) { case BASIC: { return new BasicTypeImpl<Y>( typeContext.getBindableType(), Type.PersistenceType.BASIC ); } case ENTITY: { final org.hibernate.type.EntityType type = (EntityType) typeContext.getValue().getType(); return (Type<Y>) context.locateEntityType( type.getAssociatedEntityName() ); } case EMBEDDABLE: { final Component component = (Component) typeContext.getValue(); Class javaType; if ( component.getComponentClassName() == null ) { javaType = typeContext.getBindableType(); } else { javaType = component.getComponentClass(); } final EmbeddableTypeImpl<Y> embeddableType = new EmbeddableTypeImpl<Y>( javaType, typeContext.getAttributeMetadata().getOwnerType(), (ComponentType) typeContext.getValue().getType() ); context.registerEmbeddedableType( embeddableType ); final Iterator<Property> subProperties = component.getPropertyIterator(); while ( subProperties.hasNext() ) { final Property property = subProperties.next(); final AttributeImplementor<Y, Object> attribute = buildAttribute( embeddableType, property ); if ( attribute != null ) { embeddableType.getBuilder().addAttribute( attribute ); } } embeddableType.lock(); return embeddableType; } default: { throw new AssertionFailure( "Unknown type : " + typeContext.getValueClassification() ); } } }