|
From: <jue...@we...> - 2004-06-03 15:32:26
|
Basically, you're bypassing all of SqlOperation's functionality when you =
use a custom PreparedStatementCreatorFactory. That's why I considered it =
a bug that "newPreparedStatementCreator" wasn't final before. Probably =
wasn't a particular good idea to change that at this point of time, =
though - sorry for any inconvenience.
What you can do is perform the query yourself rather than delegating to =
SqlQuery's execute method:
public class MySqlQuery extends SqlQuery {
public void myExecute(Object[] parameters) {
ResultReader rr =3D newResultReader(0, parameters, null);
return =
getJdbcTemplate().query(newMyPreparedStatementCreator(parameters), rr);
}
protected PreparedStatementCreator =
newMyPreparedStatementCreator(Object[] parameters) {
...;
}
}
Juergen
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...]On Behalf
Of Tom Turelinckx
Sent: Thursday, June 03, 2004 4:31 PM
To: spr...@li...
Subject: [Springframework-developer] newPreparedStatementCreator in
SqlOperation has become final
Hello Juergen,
While upgrading all of our applications to Spring 1.0.2, I noticed
newPreparedStatementCreator() in SqlOperation has become final. Though
this is probably a good thing, I currently don't see an easy way to have
SqlOperation use a custom PreparedStatementCreatorFactory...
We have some queries (extending SqlQuery) that use sql parameters of =
type
ARRAY, e.g.:
new SqlParameter( "dg_ids", Types.ARRAY, "DISCHARGE.NT_DIS_IDS" )
and thus require a custom (Oracle-specific)
PreparedStatementCreator/Setter to do something like this:
case Types.ARRAY:
ps.setArray( idx, getOracleArray( con, declaredParam.getTypeName(),
param ) );
break;
private ARRAY getOracleArray( Connection con, String typeName, Object =
obj
) throws SQLException {
Connection nativeCon =3D getNativeConnection( con );
return new ARRAY( ArrayDescriptor.createDescriptor( typeName,
nativeCon ), nativeCon, obj );
}
I was overriding newPreparedStatementCreator() to force the use of my =
own
OraclePreparedStatementCreator, but this is no longer possible, and, in
fact, I don't see another way of accomplishing this...
Maybe compileInternal() in SqlOperation could delegate the creation of
preparedStatementFactory to a protected
"createPreparedStatementCreatorFactory" method?
Kind regards,
Tom.
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|