Changeset 7464


Ignore:
Timestamp:
Mar 27, 2018, 3:23:58 PM (4 years ago)
Author:
Nicklas Nordborg
Message:

References #2110: QueryException? in annotation importer plug-in

Added NativeQueryWrapper which is our own wrapper around Hibernate native queries. The intention is that we should be able to intercept calls to setParameterList(...) methods and fix the underlying query parameters. A simple test has already been made using the java reflektion API and it seems to work, but needs to be cleaned up before being committed.

Location:
branches/3.12-stable/src/core/net/sf/basedb/core
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.12-stable/src/core/net/sf/basedb/core/HibernateUtil.java

    r7456 r7464  
    4747import net.sf.basedb.core.hibernate.TypeWrapper;
    4848import net.sf.basedb.core.hibernate.MultiUpdateWork;
     49import net.sf.basedb.core.hibernate.NativeQueryWrapper;
    4950import net.sf.basedb.core.hibernate.NativeSQLFunction;
    5051import net.sf.basedb.core.hibernate.TableExistsWork;
     
    19121913      NativeQuery<?> q = session.createNativeQuery(sql);
    19131914      ((Query<?>)q).setFetchSize(getJdbcFetchSize());
    1914       return q;
     1915      return new NativeQueryWrapper<>(q);
    19151916    }
    19161917    catch (HibernateException ex)
     
    19451946      }
    19461947      ((Query<R>)q).setFetchSize(getJdbcFetchSize());
    1947       return q;
     1948      return new NativeQueryWrapper<>(q);
    19481949    }
    19491950    catch (HibernateException ex)
     
    19661967      NativeQuery<?> q = session.createNativeQuery(sql);
    19671968      ((Query<?>)q).setFetchSize(getJdbcFetchSize());
    1968       return q;
     1969      return new NativeQueryWrapper<>(q);
    19691970    }
    19701971    catch (HibernateException ex)
     
    19992000      }
    20002001      ((Query<R>)q).setFetchSize(getJdbcFetchSize());
    2001       return q;
     2002      return new NativeQueryWrapper<>(q);
    20022003    }
    20032004    catch (HibernateException ex)
Note: See TracChangeset for help on using the changeset viewer.