Buggy code:
public class OracleDictionary extends DBDictionary { public static final String SELECT_HINT = "openjpa.hint.OracleSelectHint" ; public static final String VENDOR_ORACLE = "oracle" ; private static final int BEHAVE_OTHER = 0 ; private static final int BEHAVE_ORACLE = 1 ; private static final int BEHAVE_DATADIRECT31 = 2 ; private static Blob EMPTY_BLOB = null ; private static Clob EMPTY_CLOB = null ; private static final Localizer _loc = Localizer . forPackage ( OracleDictionary . class ) ; public boolean useTriggersForAutoAssign = false ; public String autoAssignSequenceName = null ; public boolean openjpa3GeneratedKeyNames = false ; public boolean useSetFormOfUseForUnicode = true ; public String xmlTypeMarker = "XMLType(?)" ; private boolean _checkedUpdateBug = false ; private boolean _warnedCharColumn = false ; private boolean _warnedNcharColumn = false ; private int _driverBehavior = - 1 ; private Method _putBytes = null ; private Method _putString = null ; private Method _putChars = null ; private int defaultBatchLimit = 100 ; public OracleDictionary ( ) { } @ Override public void endConfiguration ( ) { } @ Override public void connectedConfiguration ( Connection conn ) throws SQLException { } private void cacheDriverBehavior ( String driverVendor ) { } public void ensureDriverVendor ( ) { } @ Override public boolean supportsLocking ( Select sel ) { } @ Override protected SQLBuffer getSelects ( Select sel , boolean distinctIdentifiers , boolean forUpdate ) { } @ Override public boolean canOuterJoin ( int syntax , ForeignKey fk ) { } @ Override public SQLBuffer toNativeJoin ( Join join ) { } @ Override protected SQLBuffer toSelect ( SQLBuffer select , JDBCFetchConfiguration fetch , SQLBuffer tables , SQLBuffer where , SQLBuffer group , SQLBuffer having , SQLBuffer order , boolean distinct , boolean forUpdate , long start , long end , boolean subselect , Select sel ) { } @ Override protected SQLBuffer toSelect ( SQLBuffer select , JDBCFetchConfiguration fetch , SQLBuffer tables , SQLBuffer where , SQLBuffer group , SQLBuffer having , SQLBuffer order , boolean distinct , boolean forUpdate , long start , long end , Select sel ) { } private boolean requiresSubselectForRange ( long start , long end , boolean distinct , SQLBuffer order ) { } public String getSelectOperation ( JDBCFetchConfiguration fetch ) { } public void setString ( PreparedStatement stmnt , int idx , String val , Column col ) throws SQLException { String typeName = ( col == null ) ? null : col . getTypeIdentifier ( ) . getName ( ) ; if ( ( ( useSetFormOfUseForUnicode ) && ( typeName != null ) ) && ( ( ( typeName . toLowerCase ( ) . startsWith ( "nvarchar" ) ) || ( typeName . toLowerCase ( ) . startsWith ( "nchar" ) ) ) || ( typeName . toLowerCase ( ) . startsWith ( "nclob" ) ) ) ) { Statement inner = stmnt ; if ( inner instanceof DelegatingPreparedStatement ) inner = ( ( DelegatingPreparedStatement ) ( inner ) ) . getInnermostDelegate ( ) ; if ( OracleDictionary . isOraclePreparedStatement ( inner ) ) { try { <START_BUG> inner . getClass ( ) . getMethod ( "setFormOfUse" , new Class [ ] { int . class , short . class } ) . invoke ( inner , new Object [ ] { new Integer ( idx ) , Class . forName ( "oracle.jdbc.OraclePreparedStatement" ) . getField ( "FORM_NCHAR" ) . get ( null ) } ) ; <END_BUG> } catch ( Exception e ) { log . warn ( e ) ; } } else if ( ( ! ( _warnedNcharColumn ) ) && ( log . isWarnEnabled ( ) ) ) { _warnedNcharColumn = true ; log . warn ( OracleDictionary . _loc . get ( "unconfigured-nchar-cols" ) ) ; } } if ( ( ( ( col != null ) && ( ( col . getType ( ) ) == ( Types . CHAR ) ) ) && ( val != null ) ) && ( ( val . length ( ) ) != ( col . getSize ( ) ) ) ) { Statement inner = stmnt ; if ( inner instanceof DelegatingPreparedStatement ) inner = ( ( DelegatingPreparedStatement ) ( inner ) ) . getInnermostDelegate ( ) ; if ( OracleDictionary . isOraclePreparedStatement ( inner ) ) { try { inner . getClass ( ) . getMethod ( "setFixedCHAR" , new Class [ ] { int . class , String . class } ) . invoke ( inner , new Object [ ] { new Integer ( idx ) , val } ) ; return ; } catch ( Exception e ) { log . warn ( e ) ; } } if ( ( ! ( _warnedCharColumn ) ) && ( log . isWarnEnabled ( ) ) ) { _warnedCharColumn = true ; log . warn ( OracleDictionary . _loc . get ( "unpadded-char-cols" ) ) ; } } super . setString ( stmnt , idx , val , col ) ; } @ Override public void setBinaryStream ( PreparedStatement stmnt , int idx , InputStream val , int length , Column col ) throws SQLException { } @ Override public void setClobString ( PreparedStatement stmnt , int idx , String val , Column col ) throws SQLException { } @ Override public void setNull ( PreparedStatement stmnt , int idx , int colType , Column col ) throws SQLException { } @ Override public String getClobString ( ResultSet rs , int column ) throws SQLException { } @ Override public Timestamp getTimestamp ( ResultSet rs , int column , Calendar cal ) throws SQLException { } @ Override public Object getObject ( ResultSet rs , int column , Map map ) throws SQLException { } private static Object convertFromOracleType ( Object obj , String convertMethod ) throws SQLException { } public Column [ ] getColumns ( DatabaseMetaData meta , String catalog , String schemaName , String tableName , String columnName , Connection conn ) throws SQLException { }

Fix:
inner . getClass ( ) . getMethod ( "setFormOfUse" , new Class [ ] { int . class , short . class } ) . invoke ( inner , new Object [ ] { Integer . valueOf ( idx ) , Class . forName ( "oracle.jdbc.OraclePreparedStatement" ) . getField ( "FORM_NCHAR" ) . get ( null ) } ) ;