Buggy code:
private final transient JDBCStore _store ; public JDBCStoreQuery ( JDBCStore store , ExpressionParser parser ) { } public JDBCStore getStore ( ) { } public FilterListener getFilterListener ( String tag ) { } public Object newCompilationKey ( ) { } public boolean supportsDataStoreExecution ( ) { } protected ClassMetaData [ ] getIndependentExpressionCandidates ( ClassMetaData meta , boolean subclasses ) { } protected ExpressionFactory getExpressionFactory ( ClassMetaData meta ) { } protected ResultObjectProvider executeQuery ( Executor ex , ClassMetaData base , ClassMetaData [ ] metas , boolean subclasses , ExpressionFactory [ ] facts , QueryExpressions [ ] exps , Object [ ] params , Range range ) { } private BitSet [ ] populateUnion ( Union union , final ClassMapping [ ] mappings , final boolean subclasses , final ExpressionFactory [ ] facts , final QueryExpressions [ ] exps , final QueryExpressionsState [ ] states , final ExpContext ctx , final boolean lrs , final int eager , final long start , final long end ) { } private BitSet populateSelect ( Select sel , ClassMapping mapping , boolean subclasses , JDBCExpressionFactory fact , QueryExpressions exps , QueryExpressionsState state , ExpContext ctx , boolean lrs , int eager , long start , long end ) { } private ResultObjectProvider executeUnion ( Union union , ClassMapping [ ] mappings , QueryExpressions [ ] exps , QueryExpressionsState [ ] states , ExpContext ctx , BitSet [ ] paged ) { } private ResultObjectProvider executeSelect ( Select sel , ClassMapping mapping , QueryExpressions exps , QueryExpressionsState state , ExpContext ctx , BitSet paged , long start , long end ) { } private boolean createWhereSelects ( List sels , ClassMapping [ ] mappings , List selMappings , boolean subclasses , BitSet subclassBits , BitSet nextBits , ExpressionFactory [ ] facts , QueryExpressions [ ] exps , QueryExpressionsState [ ] states , ExpContext ctx , int subclassMode ) { } private ClassMapping [ ] getVerticalMappings ( ClassMapping mapping , boolean subclasses , QueryExpressions exps , int subclassMode ) { } private void addSubclasses ( ClassMapping mapping , Collection subs ) { } private static boolean hasVerticalSubclasses ( ClassMapping mapping ) { } private int calculateEagerMode ( QueryExpressions exps , long start , long end ) { } protected Number executeDelete ( Executor ex , ClassMetaData base , ClassMetaData [ ] metas , boolean subclasses , ExpressionFactory [ ] facts , QueryExpressions [ ] exps , Object [ ] params ) { } protected Number executeUpdate ( Executor ex , ClassMetaData base , ClassMetaData [ ] metas , boolean subclasses , ExpressionFactory [ ] facts , QueryExpressions [ ] exps , Object [ ] params ) { } private Number executeBulkOperation ( Executor ex , ClassMetaData base , ClassMetaData [ ] metas , boolean subclasses , ExpressionFactory [ ] facts , QueryExpressions [ ] exps , Object [ ] params , Map updates ) { ClassMapping [ ] mappings = ( ( ClassMapping [ ] ) ( metas ) ) ; boolean isUpdate = ( updates != null ) && ( ( updates . size ( ) ) > 0 ) ; for ( int i = 0 ; i < ( mappings . length ) ; i ++ ) { if ( ( ! ( isSingleTableMapping ( mappings [ i ] , subclasses ) ) ) && ( ! isUpdate ) ) return null ; if ( ! isUpdate ) { LifecycleEventManager mgr = ctx . getStoreContext ( ) . getBroker ( ) . getLifecycleEventManager ( ) ; if ( mgr . hasDeleteListeners ( null , mappings [ i ] ) ) return null ; } } JDBCFetchConfiguration fetch = ( ( JDBCFetchConfiguration ) ( ctx . getFetchConfiguration ( ) ) ) ; ExpContext ctx = new ExpContext ( _store , params , fetch ) ; DBDictionary dict = _store . getDBDictionary ( ) ; QueryExpressionsState [ ] state = new QueryExpressionsState [ exps . length ] ; for ( int i = 0 ; i < ( state . length ) ; i ++ ) state [ i ] = new QueryExpressionsState ( ) ; SQLBuffer [ ] sql = new SQLBuffer [ mappings . length ] ; JDBCExpressionFactory jdbcFactory ; Select sel ; for ( int i = 0 ; i < ( mappings . length ) ; i ++ ) { jdbcFactory = ( ( JDBCExpressionFactory ) ( facts [ i ] ) ) ; sel = jdbcFactory . getSelectConstructor ( ) . evaluate ( ctx , null , null , exps [ i ] , state [ i ] ) ; jdbcFactory . getSelectConstructor ( ) . select ( sel , ctx , mappings [ i ] , subclasses , exps [ i ] , state [ i ] , EAGER_NONE ) ; if ( updates == null ) <START_BUG> sql [ i ] = dict . toDelete ( mappings [ i ] , sel , _store , params ) ; <END_BUG> else sql [ i ] = dict . toUpdate ( mappings [ i ] , sel , _store , params , updates ) ; if ( ( sql [ i ] ) == null ) return null ; } _store . getContext ( ) . beginStore ( ) ; Connection conn = _store . getConnection ( ) ; long count = 0 ; try { PreparedStatement stmnt ; for ( int i = 0 ; i < ( sql . length ) ; i ++ ) { stmnt = null ; try { stmnt = sql [ i ] . prepareStatement ( conn ) ; count += stmnt . executeUpdate ( ) ; } finally { if ( stmnt != null ) try { stmnt . close ( ) ; } catch ( SQLException se ) { } } } } catch ( SQLException se ) { throw SQLExceptions . getStore ( se , ctx , _store . getDBDictionary ( ) ) ; } finally { try { conn . close ( ) ;

Fix:
sql [ i ] = dict . toDelete ( mappings [ i ] , sel , params ) ;