CMP with DB2 again. Urgent.

2000-10-09 Thread Russ White

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.





Re: CMP with DB2 again. Urgent.

2000-10-09 Thread Robert Krueger


IMHO What you describe doesn't work with orion (at least not with any 
publicly available APIs).

Sorry,

Robert

At 09:26 09.10.00 , you wrote:
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.


(-) Robert Krüger
(-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
(-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
(-) Tel: 06151 665401, Fax: 06151 665373
(-) [EMAIL PROTECTED], www.signal7.de





Re: CMP with DB2 again. Urgent.

2000-10-09 Thread Sven van 't Veer



Russ White wrote:
 
 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:
 
AFIK, there are some drivers on the market for DB2 that are better than
the Standard IBM drivers. I've never tested them, but I've seen a class
4 driver for DB2. You might want to give those a try.

-- 
==
Sven E. van 't Veer  
http://www.cachoeiro.net
Java Developer  [EMAIL PROTECTED]
==