You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by srayapati <sp...@psipower.com> on 2019/06/25 21:34:11 UTC

Custom DBDictionary setUnknown method is called with NULL Column

Our project uses EJB3 with OpenJPA 2.4.3 and TOMEE plume 7.1.0We 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
<https://github.com/apache/openjpa/blob/openjpa-parent-2.4.3/openjpa-jdbc/src/main/java/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 as
expected.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 appreciatedThanks



--
Sent from: http://openjpa.208410.n2.nabble.com/OpenJPA-Developers-f210739.html