Buggy code:
public void setResultType ( Class cls ) { } public long getStartRange ( ) { } public long getEndRange ( ) { } public void setRange ( long start , long end ) { } public String getParameterDeclaration ( ) { } public void declareParameters ( String params ) { } public void compile ( ) { } public Object getCompilation ( ) { } private QueryImpl . Compilation compileForCompilation ( ) { } protected QueryImpl . Compilation compilationFromCache ( ) { } private QueryImpl . Compilation newCompilation ( ) { } private Executor compileForExecutor ( ) { } private Executor compileForDataStore ( QueryImpl . Compilation comp ) { } private Executor compileForInMemory ( QueryImpl . Compilation comp ) { } private Executor createExecutor ( boolean inMem ) { } private boolean invalidateCompilation ( ) { } public Object execute ( ) { } public Object execute ( Object [ ] params ) { } public Object execute ( Map params ) { } private Object execute ( int operation , Object [ ] params ) { } private Object execute ( int operation , Map params ) { } public long deleteAll ( ) { } public long deleteAll ( Object [ ] params ) { } public long deleteAll ( Map params ) { } public long updateAll ( ) { } public long updateAll ( Object [ ] params ) { } public long updateAll ( Map params ) { } private Object [ ] toParameterArray ( LinkedMap paramTypes , Map params ) { } private static int positionalParameterBase ( Collection params ) { } private boolean isInMemory ( int operation ) { } private Object execute ( StoreQuery . Executor ex , Object [ ] params ) throws Exception { } private Number delete ( StoreQuery . Executor ex , Object [ ] params ) throws Exception { } public Number deleteInMemory ( StoreQuery . Executor executor , Object [ ] params ) { } private Number update ( StoreQuery . Executor ex , Object [ ] params ) throws Exception { } public Number updateInMemory ( StoreQuery . Executor executor , Object [ ] params ) { } private void updateInMemory ( Object ob , Object [ ] params ) { for ( Iterator it = getUpdates ( ) . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry e = ( ( Map . Entry ) ( it . next ( ) ) ) ; FieldMetaData fmd = ( ( FieldMetaData ) ( e . getKey ( ) ) ) ; Object val ; Object value = e . getValue ( ) ; if ( value instanceof Val ) { val = ( ( Val ) ( value ) ) . evaluate ( ob , null , getStoreContext ( ) , params ) ; } else if ( value instanceof Literal ) { val = ( ( Literal ) ( value ) ) . getValue ( ) ; } else if ( value instanceof Constant ) { val = ( ( Constant ) ( value ) ) . getValue ( params ) ; } else { <START_BUG> val = null ; <END_BUG> } OpenJPAStateManager sm = _broker . getStateManager ( ob ) ; int i = fmd . getIndex ( ) ; PersistenceCapable into = ( ( PersistenceCapable ) ( ob ) ) ; int set = OpenJPAStateManager . SET_USER ; switch ( fmd . getDeclaredTypeCode ( ) ) { case JavaTypes . BOOLEAN : sm . settingBooleanField ( into , i , sm . fetchBooleanField ( i ) , ( val == null ? false : ( ( Boolean ) ( val ) ) . booleanValue ( ) ) , set ) ; break ; case JavaTypes . BYTE : sm . settingByteField ( into , i , sm . fetchByteField ( i ) , ( val == null ? 0 : ( ( Number ) ( val ) ) . byteValue ( ) ) , set ) ; break ; case JavaTypes . CHAR : sm . settingCharField ( into , i , sm . fetchCharField ( i ) , ( val == null ? 0 : val . toString ( ) . charAt ( 0 ) ) , set ) ; break ; case JavaTypes . DOUBLE : sm . settingDoubleField ( into , i , sm . fetchDoubleField ( i ) , ( val == null ? 0 : ( ( Number ) ( val ) ) . doubleValue ( ) ) , set ) ; break ; case JavaTypes . FLOAT : sm . settingFloatField ( into , i , sm . fetchFloatField ( i ) , ( val == null ? 0 : ( ( Number ) ( val ) ) . floatValue ( ) ) , set ) ; break ; case JavaTypes . INT : sm . settingIntField ( into , i , sm . fetchIntField ( i ) , ( val == null ? 0 : ( ( Number ) ( val ) ) . intValue ( ) ) , set ) ; break ; case JavaTypes . LONG : sm . settingLongField ( into , i , sm . fetchLongField ( i ) , ( val == null ? 0 : ( ( Number ) ( val ) ) . longValue ( ) ) , set ) ; break ; case JavaTypes . SHORT : sm . settingShortField ( into , i , sm . fetchShortField ( i ) , ( val == null ? 0 : ( ( Number ) ( val ) ) . shortValue ( ) ) , set ) ; break ; case JavaTypes . STRING : sm . settingStringField ( into , i , sm . fetchStringField ( i ) , ( val == null ? null : val . toString ( ) ) , set ) ; break ;

Fix:
throw new org . apache . openjpa . util . UserException ( QueryImpl . _loc . get ( "only-update-primitives" ) ) ;