here is the conversion class I am now using:

public class OracleFieldConversion implements FieldConversion {
public OracleFieldConversion(){
}
// Implementation of org.apache.ojb.broker.accesslayer.conversions.FieldConversion


   /**
    * Describe <code>javaToSql</code> method here.
    *
    * @param object an <code>Object</code> value
    * @return an <code>Object</code> value
    * @exception ConversionException if an error occurs
    */
   public Object javaToSql(Object object) throws ConversionException {
   return new Long( object.toString() );
   }

/**
* Describe <code>sqlToJava</code> method here.
*
* @param object an <code>Object</code> value
* @return an <code>Object</code> value
* @exception ConversionException if an error occurs
*/
public Object sqlToJava(Object object) throws ConversionException {
if( object == null ) return null;
else return new Integer( object.toString() );
}
}// OracleFieldConversion


Brown, Melonie S. - Contractor wrote:

I did not realize this either. Perhaps a note in the section of the
documentation on datatypes would be helpful for others.  :)

Kristian - would you mind posting your FieldConversion code?

Thanks!

Melonie

-------- Original Message --------
Subject: Re: Possible OJB Bug with Oracle
Date: Thu, 05 Jun 2003 13:35:35 +0200
From: kristian meier <[EMAIL PROTECTED]>
Reply-To: OJB Users List <[EMAIL PROTECTED]>
Newsgroups: gmane.comp.jakarta.ojb.user
References:
<[EMAIL PROTECTED]>

Sorry for my ignorance, I just did not expected any problems while switching the databases.

with a simple FieldConversion, now all my Integer-fields also work on Oracle.

that's for help ;-)

with best wishes Kristian



Mahler Thomas wrote:



Hi again,





-----Original Message-----
From: kristian meier [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 11:54 AM
To: OJB Users List
Subject: Re: Possible OJB Bug with Oracle


Hi Thomas,


just to understand, if

repository.xml

is wrongly configured it shouldn't work with mysql, hsqldb as well not oracle.



I don't agree. Oracles datatype NUMBER is something completely different
than the INTEGER type on MySql or Hsqldb!
Oracle NUMBER expects a BigInt on the java side. If you want something
different you definitely need a FielConversion.

cheers,
Thomas





basically the same file (the platform attribute changes respectivly) works fine for mysql, hsqldb, but
not for oracle !!! all java classes are the same in each case, and the underlying java class has an int !!


so I would appreciate some further hints !!


with best wishes Kristian






Mahler Thomas wrote:





Hi Kristian,

For me this does not look like a OJB bug, but as a



configuration problem.




If you have a java attribute of type String but have defined



it as INTEGER




in the repository.xml you've got a problem!

If you want to have a String attribute converted into an



Oracle Number




column you should use a FieldConversion but not change the
PlatformOracleImpl.

cheers,
thomas





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to