Hugi...you need to save that story for Halloween...
On Thu, Sep 10, 2020 at 3:00 PM Hugi Thordarson <h...@karlmenn.is> wrote: > Hi Sébastien, > > Do you have the option of upgrading the Informix JDBC-driver? I seem to > recall that their more recent drivers *do* support > prepareStatement(String,int) but to use a newer JDBC driver you need a > compatible version of Informix (can't use the new JDBC-drivers to connect > to older versions of the DB). We couldn't do that—all the people that knew > the DB server were either dead or retired—but if that's possible in your > case, that would probably be the best solution. > > ---- Story of an ugly workaround starts. Do not read if you are young, > impersonable or mentally unstable. In fact, probably just don't read this > at all. > > But yes, I encountered this issue a couple of years ago and I didn't > really solve it. Cayenne 4.1+ will use prepareStatement( String, int ) if > the table has a DB-generated PK column. In my case, the non-solution I > ended with was make the generated PK "Cayenne generated". Then I > implemented a PKGenerator that just returned "null" for the PK. Then I > excluded the PK-column from insert statements using an > InsertBatchTranslator (because Informix would not populate the PK/serial's > value if it was set to null in the insert statement). Then I just threw > away the poor ObjectContext that did all these horrible things and > re-fetched the inserted objects in a new context, now with DB generated PKs. > This is obviously horrid. But it worked as a temporary workaround while we > were in the process of migrating to Postgres. > > ---- Ugly workaround ends > > So in short: I hope you can upgrade the JDBC driver. Or that I am in the > wrong and someone has a better solution for you. > > - hugi > > > > > On 10 Sep 2020, at 10:24, Sébastien Pérès-Labourdette < > sebastien.peres-labourde...@omerin.com> wrote: > > > > Hi there. > > > > While integrating 4.1 we found that the informix jdbc driver from ibm > > does not support > > IfxSqliConnection:prepareStatement(String,int) > > > > Invoked from > > connection.prepareStatement(compiled.getSql(), generatedKeys); in > > SQLTemplateAction.execute > > > > FYI,4.0.2 sqltemplates are fine with this jdbc driver. > > > > Is there anything we can do (replacing informix with any other rdbms not > > being an option) to get 4.1 sqltemplates running as smooth as the 4.0.2 > > ones ? > > > > -- > > Sébastien > > > >