Buggy code:
public class TableSchemaFactory implements SchemaFactory , Configurable { public static final String ACTION_ADD = "add" ; public static final String ACTION_DROP = "drop" ; private static final Localizer _loc = Localizer . forPackage ( TableSchemaFactory . class ) ; private static boolean _refreshedTable = false ; private JDBCConfiguration _conf = null ; private Log _log = null ; private DBIdentifier _table = DBIdentifier . newTable ( "OPENJPA_SCHEMA" ) ; private DBIdentifier _pkColumnName = DBIdentifier . newColumn ( "ID" ) ; private DBIdentifier _schemaColumnName = DBIdentifier . newColumn ( "SCHEMA_DEF" ) ; private Column _pkColumn = null ; private Column _schemaColumn = null ; public String getTable ( ) { } public void setTable ( String name ) { } public void setTableName ( String name ) { } public void setPrimaryKeyColumn ( String name ) { } public String getPrimaryKeyColumn ( ) { } public void setSchemaColumn ( String name ) { } public String getSchemaColumn ( ) { } public JDBCConfiguration getConfiguration ( ) { } public void setConfiguration ( Configuration conf ) { } public void startConfiguration ( ) { } public void endConfiguration ( ) { } public synchronized SchemaGroup readSchema ( ) { } public void storeSchema ( SchemaGroup schema ) { } public void refreshTable ( ) throws SQLException { } public void dropTable ( ) throws SQLException { } public String readSchemaColumn ( ) throws SQLException { DBDictionary dict = _conf . getDBDictionaryInstance ( ) ; SQLBuffer sel = new SQLBuffer ( dict ) . append ( _schemaColumn ) ; <START_BUG> SQLBuffer where = new SQLBuffer ( dict ) . append ( _pkColumn ) . append ( "<seq2seq4repair_space>=<seq2seq4repair_space>" ) . appendValue ( Numbers . valueOf ( 1 ) , _pkColumn ) ; <END_BUG> SQLBuffer tables = new SQLBuffer ( dict ) . append ( _pkColumn . getTable ( ) ) ; SQLBuffer select = dict . toSelect ( sel , null , tables , where , null , null , null , false , false , 0 , Long . MAX_VALUE ) ; Connection conn = getConnection ( ) ; PreparedStatement stmnt = null ; ResultSet rs = null ; boolean wasAuto = true ; try { wasAuto = conn . getAutoCommit ( ) ; if ( ! wasAuto ) conn . setAutoCommit ( true ) ; stmnt = select . prepareStatement ( conn ) ; dict . setQueryTimeout ( stmnt , _conf . getQueryTimeout ( ) ) ; rs = stmnt . executeQuery ( ) ; rs . next ( ) ; String schema = ( ( _schemaColumn . getType ( ) ) == ( Types . CLOB ) ) ? dict . getClobString ( rs , 1 ) : dict . getString ( rs , 1 ) ; return schema ; } finally { if ( rs != null ) try { rs . close ( ) ; } catch ( SQLException se ) { } if ( stmnt != null ) try { stmnt . close ( ) ; } catch ( SQLException se ) { } if ( ! wasAuto ) conn . setAutoCommit ( false ) ; try { conn . close ( ) ; } catch ( SQLException se ) { } } } public void writeSchemaColumn ( String schema ) throws SQLException { } private void buildTable ( ) { } private Connection getConnection ( ) throws SQLException { } public static void main ( String [ ] args ) throws IOException , SQLException { } public static boolean run ( JDBCConfiguration conf , String [ ] args , Options opts ) throws IOException , SQLException { } public static boolean run ( JDBCConfiguration conf , String action ) throws IOException , SQLException { } }

Fix:
SQLBuffer where = new SQLBuffer ( dict ) . append ( _pkColumn ) . append ( "<seq2seq4repair_space>=<seq2seq4repair_space>" ) . appendValue ( 1 , _pkColumn ) ;