Our project uses EJB3 with OpenJPA 2.4.3 and TOMEE plume 7.1.0

We have a custom /DBDictionary /that requires the Column data passed to this method:

    - public void setUnknown(PreparedStatement stmt, int idx, Object 
val,*Column col)*  throws SQLException {

When a prepared statement is executed, the logic in//org.apache.openjpa.jdbc.kernel.PreparedSQLStoreQuery.java calls DBDictionary.setUnknown with a hard-coded NULL value for Column parameter.

//


We have an older version of org.apache.openjpa_1.3.0.0_1-1-1-SNAPSHOT.jar packaged in Weblogic and the DBDictionary  setUnknown works correctly. Column data is passed in correctly.

To get around this issue, we tried the following change and the rest of our logic works as expected. Please advise if this change is correct or if you suspect any other issues with this code.

            ResultObjectProvider rop;
            PreparedStatement stmnt = null;
            try {
                stmnt = !range.lrs ? buf.prepareStatement(conn) : 
buf.prepareStatement(conn, fetch, -1, -1);
                int index = 0;
                SelectImpl cachedSelect = pq.getSelect();
SQLBuffer sqlBuffer = cachedSelect.getSQL(); List columns = sqlBuffer.getColumns(); for (int i = 0; i < params.length; i++) { */if(columns != null && columns.size()>i) {/**//**/dict.setUnknown(stmnt, ++index, params[i], (org.apache.openjpa.jdbc.schema.Column) columns.get(i));/**//**/} else {/**//**/dict.setUnknown(stmnt, ++index, params[i], null);/**//**/}/*
                }
                dict.setTimeouts(stmnt, fetch, false);

                ResultSet rs = stmnt.executeQuery();

                Result res = cachedSelect.getEagerResult(conn, stmnt, rs, 
store, fetch, false, null);

Your help is greatly appreciated

Thanks

--

**Spurthy Rayapati**
/Sr Software Developer/
Physical Systems Integration <http://www.psipower.com>

Reply via email to