private boolean determineNaturalIdNullability() { boolean[] nullability = getPropertyNullability(); for ( int position : getNaturalIdentifierProperties() ) { // if any individual property is nullable, return false if ( nullability[position] ) { return false; } } // return true if we found no individually nullable properties return true; }
final int[] naturalIdPropertyIndexes = this.getNaturalIdentifierProperties(); int valuesIndex = -1; for ( int propIdx = 0; propIdx < naturalIdPropertyIndexes.length; propIdx++ ) {
int[] naturalIdPropertyIndexes = getNaturalIdentifierProperties(); int naturalIdPropertyCount = naturalIdPropertyIndexes.length; boolean[] naturalIdMarkers = new boolean[getPropertySpan()];
int positions = 1; int loop = 0; for ( int idPosition : getNaturalIdentifierProperties() ) { final Object naturalIdValue = naturalIdValues[loop++]; if ( naturalIdValue != null ) {
private String generateEntityIdByNaturalIdSql() { Select select = new Select( getFactory().getDialect() ); if ( getFactory().getSettings().isCommentsEnabled() ) { select.setComment( "get current natural-id->entity-id state " + getEntityName() ); } final String rootAlias = getRootAlias(); select.setSelectClause( identifierSelectFragment( rootAlias, "" ) ); select.setFromClause( fromTableFragment( rootAlias ) + fromJoinFragment( rootAlias, true, false ) ); final StringBuilder whereClause = new StringBuilder(); final int[] propertyTableNumbers = getPropertyTableNumbers(); final int[] naturalIdPropertyIndexes = this.getNaturalIdentifierProperties(); for ( int propIdx = 0; propIdx < naturalIdPropertyIndexes.length; propIdx++ ) { if ( propIdx > 0 ) { whereClause.append( " and " ); } final int naturalIdIdx = naturalIdPropertyIndexes[propIdx]; final String tableAlias = generateTableAlias( rootAlias, propertyTableNumbers[naturalIdIdx] ); final String[] propertyColumnNames = getPropertyColumnNames( naturalIdIdx ); final String[] aliasedPropertyColumns = StringHelper.qualify( tableAlias, propertyColumnNames ); whereClause.append( StringHelper.join( "=? and ", aliasedPropertyColumns ) ).append( "=?" ); } whereClause.append( whereJoinFragment( getRootAlias(), true, false ) ); return select.setOuterJoins( "", "" ).setWhereClause( whereClause.toString() ).toStatementString(); }
private String generateEntityIdByNaturalIdSql() { Select select = new Select( getFactory().getDialect() ); if ( getFactory().getSettings().isCommentsEnabled() ) { select.setComment( "get current natural-id->entity-id state " + getEntityName() ); } final String rootAlias = getRootAlias(); select.setSelectClause( identifierSelectFragment( rootAlias, "" ) ); select.setFromClause( fromTableFragment( rootAlias ) + fromJoinFragment( rootAlias, true, false ) ); final StringBuilder whereClause = new StringBuilder(); final int[] propertyTableNumbers = getPropertyTableNumbers(); final int[] naturalIdPropertyIndexes = this.getNaturalIdentifierProperties(); for ( int propIdx = 0; propIdx < naturalIdPropertyIndexes.length; propIdx++ ) { if ( propIdx > 0 ) { whereClause.append( " and " ); } final int naturalIdIdx = naturalIdPropertyIndexes[propIdx]; final String tableAlias = generateTableAlias( rootAlias, propertyTableNumbers[naturalIdIdx] ); final String[] propertyColumnNames = getPropertyColumnNames( naturalIdIdx ); final String[] aliasedPropertyColumns = StringHelper.qualify( tableAlias, propertyColumnNames ); whereClause.append( StringHelper.join( "=? and ", aliasedPropertyColumns ) ).append( "=?" ); } whereClause.append( whereJoinFragment( getRootAlias(), true, false ) ); return select.setOuterJoins( "", "" ).setWhereClause( whereClause.toString() ).toStatementString(); }
int positions = 1; int loop = 0; for ( int idPosition : getNaturalIdentifierProperties() ) { final Type type = getPropertyTypes()[idPosition]; type.nullSafeSet( ps, naturalIdValues[loop++], positions, session );
int positions = 1; int loop = 0; for ( int idPosition : getNaturalIdentifierProperties() ) { final Type type = getPropertyTypes()[idPosition]; type.nullSafeSet( ps, naturalIdValues[loop++], positions, session );
int[] naturalIdPropertyIndexes = getNaturalIdentifierProperties(); int naturalIdPropertyCount = naturalIdPropertyIndexes.length; boolean[] naturalIdMarkers = new boolean[ getPropertySpan() ];
int[] naturalIdPropertyIndexes = getNaturalIdentifierProperties(); int naturalIdPropertyCount = naturalIdPropertyIndexes.length; boolean[] naturalIdMarkers = new boolean[ getPropertySpan() ];