/** * Called to apply column definitions from the referenced FK column to this column. * * @param column the referenced column. */ public void overrideFromReferencedColumnIfNecessary(org.hibernate.mapping.Column column) { if (getMappingColumn() != null) { // columnDefinition can also be specified using @JoinColumn, hence we have to check // whether it is set or not if ( StringHelper.isEmpty( sqlType ) ) { sqlType = column.getSqlType(); getMappingColumn().setSqlType( sqlType ); } // these properties can only be applied on the referenced column - we can just take them over getMappingColumn().setLength(column.getLength()); getMappingColumn().setPrecision(column.getPrecision()); getMappingColumn().setScale(column.getScale()); } }
public void addDefaultJoinColumnName(PersistentClass referencedEntity, String logicalReferencedColumn) { final String columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn ); getMappingColumn().setName( columnName ); setLogicalColumnName( columnName ); }
/** * used for mappedBy cases */ public void linkValueUsingAColumnCopy(Column column, SimpleValue value) { initMappingColumn( //column.getName(), column.getQuotedName(), null, column.getLength(), column.getPrecision(), column.getScale(), getMappingColumn().isNullable(), column.getSqlType(), getMappingColumn().isUnique(), false //We do copy no strategy here ); linkWithValue( value ); }
public void linkValueUsingDefaultColumnNaming( Column referencedColumn, PersistentClass referencedEntity, SimpleValue value) { String logicalReferencedColumn = getBuildingContext().getMetadataCollector().getLogicalColumnName( referencedEntity.getTable(), referencedColumn.getQuotedName() ); String columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn ); //yuk side effect on an implicit column setLogicalColumnName( columnName ); setReferencedColumn( logicalReferencedColumn ); initMappingColumn( columnName, null, referencedColumn.getLength(), referencedColumn.getPrecision(), referencedColumn.getScale(), getMappingColumn() != null ? getMappingColumn().isNullable() : false, referencedColumn.getSqlType(), getMappingColumn() != null ? getMappingColumn().isUnique() : false, false ); linkWithValue( value ); }
private void applyComponentColumnSizeValueToJoinColumn(Column column, Ejb3JoinColumn joinColumn) { Column mappingColumn = joinColumn.getMappingColumn(); mappingColumn.setLength( column.getLength() ); mappingColumn.setPrecision( column.getPrecision() ); mappingColumn.setScale( column.getScale() ); }
@Override public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) { if ( StringHelper.isNotEmpty( columnName ) ) { if ( applyNamingStrategy ) { getMappingColumn().setName( getBuildingContext().getBuildingOptions().getPhysicalNamingStrategy().toPhysicalColumnName( getBuildingContext().getMetadataCollector().getDatabase().toIdentifier( columnName ), getBuildingContext().getMetadataCollector().getDatabase().getJdbcEnvironment() ).render() ); } else { getMappingColumn().setName( columnName ); } } }
if ( !idColumnNames.contains( col.getMappingColumn().getName() ) ) { mapToPK = false; break;
@Override protected void addColumnBinding(SimpleValue value) { if ( StringHelper.isEmpty( mappedBy ) ) { // was the column explicitly quoted in the mapping/annotation // TODO: in metamodel, we need to better split global quoting and explicit quoting w/ respect to logical names boolean isLogicalColumnQuoted = StringHelper.isQuoted( getLogicalColumnName() ); final ObjectNameNormalizer nameNormalizer = getBuildingContext().getObjectNameNormalizer(); final String logicalColumnName = nameNormalizer.normalizeIdentifierQuotingAsString( getLogicalColumnName() ); final String referencedColumn = nameNormalizer.normalizeIdentifierQuotingAsString( getReferencedColumn() ); final String unquotedLogColName = StringHelper.unquote( logicalColumnName ); final String unquotedRefColumn = StringHelper.unquote( referencedColumn ); String logicalCollectionColumnName = StringHelper.isNotEmpty( unquotedLogColName ) ? unquotedLogColName : getPropertyName() + '_' + unquotedRefColumn; logicalCollectionColumnName = getBuildingContext().getMetadataCollector() .getDatabase() .getJdbcEnvironment() .getIdentifierHelper() .toIdentifier( logicalCollectionColumnName, isLogicalColumnQuoted ) .render(); getBuildingContext().getMetadataCollector().addColumnNameBinding( value.getTable(), logicalCollectionColumnName, getMappingColumn() ); } }
/** * Called to apply column definitions from the referenced FK column to this column. * * @param column the referenced column. */ public void overrideFromReferencedColumnIfNecessary(org.hibernate.mapping.Column column) { if (getMappingColumn() != null) { // columnDefinition can also be specified using @JoinColumn, hence we have to check // whether it is set or not if ( StringHelper.isEmpty( sqlType ) ) { sqlType = column.getSqlType(); getMappingColumn().setSqlType( sqlType ); } // these properties can only be applied on the referenced column - we can just take them over getMappingColumn().setLength(column.getLength()); getMappingColumn().setPrecision(column.getPrecision()); getMappingColumn().setScale(column.getScale()); } }
public void addDefaultJoinColumnName(PersistentClass referencedEntity, String logicalReferencedColumn) { final String columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn ); getMappingColumn().setName( columnName ); setLogicalColumnName( columnName ); }
@Override public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) { if ( StringHelper.isNotEmpty( columnName ) ) { getMappingColumn().setName( applyNamingStrategy ? getMappings().getNamingStrategy().columnName( columnName ) : columnName ); } }
public void linkValueUsingDefaultColumnNaming( Column referencedColumn, PersistentClass referencedEntity, SimpleValue value ) { String columnName; String logicalReferencedColumn = getMappings().getLogicalColumnName( referencedColumn.getQuotedName(), referencedEntity.getTable() ); columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn ); //yuk side effect on an implicit column setLogicalColumnName( columnName ); setReferencedColumn( logicalReferencedColumn ); initMappingColumn( columnName, null, referencedColumn.getLength(), referencedColumn.getPrecision(), referencedColumn.getScale(), getMappingColumn() != null ? getMappingColumn().isNullable() : false, referencedColumn.getSqlType(), getMappingColumn() != null ? getMappingColumn().isUnique() : false, false ); linkWithValue( value ); }
/** * used for mappedBy cases */ public void linkValueUsingAColumnCopy(Column column, SimpleValue value) { initMappingColumn( //column.getName(), column.getQuotedName(), null, column.getLength(), column.getPrecision(), column.getScale(), getMappingColumn().isNullable(), column.getSqlType(), getMappingColumn().isUnique(), false //We do copy no strategy here ); linkWithValue( value ); }
if ( !idColumnNames.contains( col.getMappingColumn().getName() ) ) { mapToPK = false; break;
protected void addColumnBinding(SimpleValue value) { if ( StringHelper.isEmpty( mappedBy ) ) { String unquotedLogColName = StringHelper.unquote( getLogicalColumnName() ); String unquotedRefColumn = StringHelper.unquote( getReferencedColumn() ); String logicalColumnName = getMappings().getNamingStrategy() .logicalCollectionColumnName( unquotedLogColName, getPropertyName(), unquotedRefColumn ); if ( StringHelper.isQuoted( getLogicalColumnName() ) || StringHelper.isQuoted( getLogicalColumnName() ) ) { logicalColumnName = StringHelper.quote( logicalColumnName ); } getMappings().addColumnBinding( logicalColumnName, getMappingColumn(), value.getTable() ); } }
public void overrideSqlTypeIfNecessary(org.hibernate.mapping.Column column) { if ( StringHelper.isEmpty( sqlType ) ) { sqlType = column.getSqlType(); if ( getMappingColumn() != null ) getMappingColumn().setSqlType( sqlType ); } }
public void addDefaultJoinColumnName(PersistentClass referencedEntity, String logicalReferencedColumn) { final Identifier columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn ); getMappingColumn().setName( columnName ); setLogicalColumnName( columnName ); }
public void addDefaultJoinColumnName(PersistentClass referencedEntity, String logicalReferencedColumn) { final String columnName = buildDefaultColumnName( referencedEntity, logicalReferencedColumn ); getMappingColumn().setName( columnName ); setLogicalColumnName( columnName ); }
@Override public void redefineColumnName(String columnName, String propertyName, boolean applyNamingStrategy) { if ( StringHelper.isNotEmpty( columnName ) ) { getMappingColumn().setName( applyNamingStrategy ? getMappings().getNamingStrategy().columnName( columnName ) : columnName ); } }
private void applyComponentColumnValuesToJoinColumn(Column column, Ejb3JoinColumn joinColumn) { Column mappingColumn = joinColumn.getMappingColumn(); mappingColumn.setLength( column.getLength() ); mappingColumn.setPrecision( column.getPrecision() ); mappingColumn.setScale( column.getScale() ); mappingColumn.setNullable( column.isNullable() ); }