Hey folks,
I really need an answer to this question because while I would love to use Orion
I cannot risk moving my 100+ EJBs over to Orion until I can get this resolved. I
am at a critical descission point here.
The IBM DB2 JDBC drivers do not allow SetNull(FLOAT). Instead you have to use
setObject(null). I know this a bug in the JDBC driver, but there are work
arounds.
Here is how I do it with Inprise Application Server (which I am using now).
I write the follow class which implements JdbcAccesserFactory:
package com.saralee.cw.quality.gt.ejb;
import com.inprise.ejb.cmp.*;
public class MyFactory implements com.inprise.ejb.cmp.JdbcAccesserFactory {
private class FloatSetter implements com.inprise.ejb.cmp.JdbcSetter {
public void set(java.sql.PreparedStatement preparedStatement, int index,
Object object)
throws java.sql.SQLException {
Float f = (Float) object;
if(f == null) {
preparedStatement.setObject(index, null);
}
else {
preparedStatement.setFloat(index, f.floatValue());
}
}
}
private class FloatGetter implements com.inprise.ejb.cmp.JdbcGetter {
public Object get(java.sql.ResultSet resultSet, int index, ClassLoader
classLoader)
throws java.sql.SQLException {
float ff = resultSet.getFloat(index);
Float result = null;
if(!resultSet.wasNull()) {
result = new Float(ff);
}
// System.err.println("The getter result was: "+result);
return result;
}
}
public MyFactory(java.util.Properties properties) {
}
public com.inprise.ejb.cmp.JdbcGetter getGetter(Class fieldType, String
fieldName) {
if(fieldType == Float.class || fieldType == Float.TYPE) {
return new FloatGetter();
}
else {
return null;
}
}
public com.inprise.ejb.cmp.JdbcSetter getSetter(Class fieldType, String
fieldName) {
if(fieldType == Float.class || fieldType == Float.TYPE) {
return new FloatSetter();
}
else {
return null;
}
}
}
So how can I accomplish the same thing in Orion?
Using DB2 is a design contrant, and I don't have any choice on that one.
P.S. To you Orion developers, It might look pretty good for you to have a nice
big corporation like Sara Lee (My employer) using Orion. We could potentially
shift a large amount of our work over from IAS to Orion. I like your product and
I hope it works for us.