I took a quick look at this bug. It seems to me Derby Client is behaving as expected rather than the embedded driver though it doesn't seem like it. The query in question gets a ResultSet and its metadata as:

           ResultSet rs = s.executeQuery("SELECT id, name FROM readonlytest");
           ResultSetMetaData metaData = rs.getMetaData();
           if (metaData.isReadOnly(1))
                System.out.println("ID column is readonly");

Since a FOR UPDATE clause is not specified, the resultset that is returned is readonly, which is what Derby client returns for metaData.isReadOnly(1). Once a FOR UPDATE clause is added, Derby client doesn't report the column as readonly.

The problem is really with the embedded driver... Even when FOR UPDATE clause is not specified, current implementation of isReadOnly() still returns FALSE, when returning TRUE seems more correct.

EmbedResultSetMetaData.java:
    public boolean isReadOnly(int column) throws SQLException {
        validColumnNumber(column);
        // we just don't know if it is a base table column or not
        return false;
    }

Satheesh

--- Begin Message ---
I cleaned up the instructions a little and put them here:

http://db.apache.org/derby/integrate/db_torque.html

Also, note that Torque currently only works with the derby embedded driver, not with the derby network client. For details see http://issues.apache.org/jira/browse/DERBY-142 .

 -jean




--- End Message ---

Reply via email to