sourceDocument, (SingularAttributeSourceBasic) attributeSource, new SimpleValue( sourceDocument, component.getTable() ), component.getComponentClassName() );
SimpleValue value = new SimpleValue( buildingContext, component.getTable() ); property.setValue( value ); final SimpleValue referencedValue = (SimpleValue) referencedProperty.getValue();
(PluralAttributeSequentialIndexSource) attributeSource.getIndexSource(); final SimpleValue indexBinding = new SimpleValue( mappingDocument, collectionBinding.getCollectionTable()
public SimpleValue make() { validate(); LOG.debugf( "building SimpleValue for %s", propertyName ); if ( table == null ) { table = columns[0].getTable(); } simpleValue = new SimpleValue( buildingContext, table ); if ( isVersion ) { simpleValue.makeVersion(); } if ( isNationalized ) { simpleValue.makeNationalized(); } if ( isLob ) { simpleValue.makeLob(); } linkWithValue(); boolean isInSecondPass = buildingContext.getMetadataCollector().isInSecondPass(); if ( !isInSecondPass ) { //Defer this to the second pass buildingContext.getMetadataCollector().addSecondPass( new SetSimpleValueTypeSecondPass( this ) ); } else { //We are already in second pass fillSimpleValue(); } return simpleValue; }
if ( idSource != null ) { final IdentifierCollection idBagBinding = (IdentifierCollection) getCollectionBinding(); final SimpleValue idBinding = new SimpleValue( mappingDocument, idBagBinding.getCollectionTable()
private static void bindDiscriminatorColumnToRootPersistentClass( RootClass rootClass, Ejb3DiscriminatorColumn discriminatorColumn, Map<String, Join> secondaryTables, PropertyHolder propertyHolder, MetadataBuildingContext context) { if ( rootClass.getDiscriminator() == null ) { if ( discriminatorColumn == null ) { throw new AssertionFailure( "discriminator column should have been built" ); } discriminatorColumn.setJoins( secondaryTables ); discriminatorColumn.setPropertyHolder( propertyHolder ); SimpleValue discriminatorColumnBinding = new SimpleValue( context, rootClass.getTable() ); rootClass.setDiscriminator( discriminatorColumnBinding ); discriminatorColumn.linkWithValue( discriminatorColumnBinding ); discriminatorColumnBinding.setTypeName( discriminatorColumn.getDiscriminatorTypeName() ); rootClass.setPolymorphic( true ); if ( LOG.isTraceEnabled() ) { LOG.tracev( "Setting discriminator for entity {0}", rootClass.getEntityName() ); } } }
@Test public void testBasicOperation() { SimpleValue simpleValue = new SimpleValue( new MetadataBuildingContextTestingImpl() ); simpleValue.setJpaAttributeConverterDescriptor( new InstanceBasedConverterDescriptor( new StringClobConverter(), new ClassmateContext() ) ); simpleValue.setTypeUsingReflection( IrrelevantEntity.class.getName(), "name" ); Type type = simpleValue.getType(); assertNotNull( type ); if ( !AttributeConverterTypeAdapter.class.isInstance( type ) ) { fail( "AttributeConverter not applied" ); } AbstractStandardBasicType basicType = assertTyping( AbstractStandardBasicType.class, type ); assertSame( StringTypeDescriptor.INSTANCE, basicType.getJavaTypeDescriptor() ); assertEquals( Types.CLOB, basicType.getSqlTypeDescriptor().getSqlType() ); }
targetValue = new SimpleValue( getBuildingContext(), collection.getCollectionTable() ); targetValue.copyTypeFrom( sourceValue );
final EntityHierarchySourceImpl hierarchySource, RootClass rootEntityDescriptor) { final SimpleValue discriminatorValue = new SimpleValue( sourceDocument, rootEntityDescriptor.getTable()
mappingDocument, basicAttributeSource, new SimpleValue( mappingDocument, table ), entityDescriptor.getClassName() );
final VersionAttributeSource versionAttributeSource = hierarchySource.getVersionAttributeSource(); final SimpleValue versionValue = new SimpleValue( sourceDocument, rootEntityDescriptor.getTable()
final IdentifierSourceSimple idSource = (IdentifierSourceSimple) hierarchySource.getIdentifierSource(); final SimpleValue idValue = new SimpleValue( sourceDocument, rootEntityDescriptor.getTable()
final PluralAttributeMapKeySourceBasic mapKeySource = (PluralAttributeMapKeySourceBasic) pluralAttributeSource.getIndexSource(); final SimpleValue value = new SimpleValue( mappingDocument, collectionBinding.getCollectionTable()
@Test public void testProperCallbacks() { final MetadataImplementor metadata = (MetadataImplementor) new MetadataSources( serviceRegistry ) .buildMetadata(); final Table tbl = new Table(); final RootClass rootClass = new RootClass( metadataBuildingContext ); ValueVisitor vv = new ValueVisitorValidator(); MetadataBuildingContextTestingImpl metadataBuildingContext = new MetadataBuildingContextTestingImpl(); new Any( metadataBuildingContext, tbl ).accept( vv ); new Array( metadataBuildingContext, rootClass ).accept( vv ); new Bag( metadataBuildingContext, rootClass ).accept( vv ); new Component( metadataBuildingContext, rootClass ).accept( vv ); new DependantValue( metadataBuildingContext, tbl, null ).accept( vv ); new IdentifierBag( metadataBuildingContext, rootClass ).accept( vv ); new List( metadataBuildingContext, rootClass ).accept( vv ); new ManyToOne( metadataBuildingContext, tbl ).accept( vv ); new Map( metadataBuildingContext, rootClass ).accept( vv ); new OneToMany( metadataBuildingContext, rootClass ).accept( vv ); new OneToOne( metadataBuildingContext, tbl, rootClass ).accept( vv ); new PrimitiveArray( metadataBuildingContext, rootClass ).accept( vv ); new Set( metadataBuildingContext, rootClass ).accept( vv ); new SimpleValue( metadataBuildingContext ).accept( vv ); }
public SimpleValue make() { validate(); log.debug( "building SimpleValue for {}", propertyName ); if ( table == null ) { table = columns[0].getTable(); } simpleValue = new SimpleValue( table ); linkWithValue(); boolean isInSecondPass = mappings.isInSecondPass(); SetSimpleValueTypeSecondPass secondPass = new SetSimpleValueTypeSecondPass(this); if (!isInSecondPass) { //Defer this to the second pass mappings.addSecondPass(secondPass); } else { //We are already in second pass fillSimpleValue(); } return simpleValue; }
private static void bindDiscriminatorToPersistentClass( RootClass rootClass, Ejb3DiscriminatorColumn discriminatorColumn, Map<String, Join> secondaryTables, PropertyHolder propertyHolder ) { if ( rootClass.getDiscriminator() == null ) { if ( discriminatorColumn == null ) { throw new AssertionFailure( "discriminator column should have been built" ); } discriminatorColumn.setJoins( secondaryTables ); discriminatorColumn.setPropertyHolder( propertyHolder ); SimpleValue discrim = new SimpleValue( rootClass.getTable() ); rootClass.setDiscriminator( discrim ); discriminatorColumn.linkWithValue( discrim ); discrim.setTypeName( discriminatorColumn.getDiscriminatorTypeName() ); rootClass.setPolymorphic( true ); log.trace( "Setting discriminator for entity {}", rootClass.getEntityName() ); } }
SimpleValue value = new SimpleValue( component.getTable() ); property.setValue( value ); final SimpleValue referencedValue = (SimpleValue) referencedProperty.getValue();
targetValue = new SimpleValue( collection.getCollectionTable() ); targetValue.setTypeName( sourceValue.getTypeName() ); targetValue.setTypeParameters( sourceValue.getTypeParameters() );
final PluralAttributeElementSourceBasic elementSource = (PluralAttributeElementSourceBasic) getPluralAttributeSource().getElementSource(); final SimpleValue elementBinding = new SimpleValue( getMappingDocument(), getCollectionBinding().getCollectionTable()
private SimpleValue bindColumnToSimpleValue(Table table, Column column, Mapping mapping, boolean generatedIdentifier) { SimpleValue value = new SimpleValue(mdbc, table); value.addColumn(column); value.setTypeName(guessAndAlignType(table, column, mapping, generatedIdentifier)); return value; }