下面列出了org.hibernate.internal.util.collections.ArrayHelper#isAllFalse ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private String determinePkByNaturalIdQuery(boolean[] valueNullness) {
if ( !hasNaturalIdentifier() ) {
throw new HibernateException(
"Attempt to build natural-id -> PK resolution query for entity that does not define natural id"
);
}
// performance shortcut for cases where the natural-id is defined as completely non-nullable
if ( isNaturalIdNonNullable() ) {
if ( valueNullness != null && !ArrayHelper.isAllFalse( valueNullness ) ) {
throw new HibernateException( "Null value(s) passed to lookup by non-nullable natural-id" );
}
if ( cachedPkByNonNullableNaturalIdQuery == null ) {
cachedPkByNonNullableNaturalIdQuery = generateEntityIdByNaturalIdSql( null );
}
return cachedPkByNonNullableNaturalIdQuery;
}
// Otherwise, regenerate it each time
return generateEntityIdByNaturalIdSql( valueNullness );
}
public boolean isInsertable() {
// if the property mapping consists of all formulas,
// make it non-insertable
final boolean[] columnInsertability = value.getColumnInsertability();
return insertable && (
columnInsertability.length==0 ||
!ArrayHelper.isAllFalse( columnInsertability )
);
}
public boolean isUpdateable() {
// if the property mapping consists of all formulas,
// make it non-updateable
return updateable && !ArrayHelper.isAllFalse( value.getColumnUpdateability() );
}
@Override
protected int doUpdateRows(Serializable id, PersistentCollection collection, SharedSessionContractImplementor session)
throws HibernateException {
if ( ArrayHelper.isAllFalse( elementColumnIsSettable ) ) {
return 0;
}
try {
final Expectation expectation = Expectations.appropriateExpectation( getUpdateCheckStyle() );
final boolean callable = isUpdateCallable();
final int jdbcBatchSizeToUse = session.getConfiguredJdbcBatchSize();
boolean useBatch = expectation.canBeBatched() && jdbcBatchSizeToUse > 1;
final Iterator entries = collection.entries( this );
final List elements = new ArrayList();
while ( entries.hasNext() ) {
elements.add( entries.next() );
}
final String sql = getSQLUpdateRowString();
int count = 0;
if ( collection.isElementRemoved() ) {
// the update should be done starting from the end to the list
for ( int i = elements.size() - 1; i >= 0; i-- ) {
count = doUpdateRow(
id,
collection,
session,
expectation,
callable,
useBatch,
elements,
sql,
count,
i
);
}
}
else {
for ( int i = 0; i < elements.size(); i++ ) {
count = doUpdateRow(
id,
collection,
session,
expectation,
callable,
useBatch,
elements,
sql,
count,
i
);
}
}
return count;
}
catch (SQLException sqle) {
throw session.getJdbcServices().getSqlExceptionHelper().convert(
sqle,
"could not update collection rows: " + MessageHelper.collectionInfoString(
this,
collection,
id,
session
),
getSQLUpdateRowString()
);
}
}