Okay, I have successfully traced the source of this problem. Firstly, I'm 
using the current MySQL Connector/J 5.1.5 binary.

I was using the recommended MySQL driver (as per all the Resin tutorials) 
which is:


However, if I change this to:


then the problem I faced resolves itself. So one might think it's a problem 
with that driver (which it might be - I haven't checked older versions of 
Connector/J). As a temporary fix I'm leaving this as my driver - unless you 
have a good reason not to?

However, I've gone further and delved into the source for the latest 
snapshot (31st March). Using the MysqlConnectionPoolDataSource driver, I've 
traced the problem to the following method:


and the pair of lines:

if(resultType > 0)
  return conn.prepareStatement(sql,resultType);

This is returning null since the resultType passed in to the 
prepareStatement method is 1. If I force resultType=0 in this method, 
everything works as expected. I guess this is something to do with caching 
statements (and for a new object being persisted those haven't already been 
cached?), but I'll leave such inferences up to the experts ;)

So in summary, I'm not sure if this is a bug in Resin or Connector/J 5.1.5, 
but the recommended MySQL pooled driver certainly doesn't work as expected.


resin-interest mailing list

Reply via email to