geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianny Damour <gianny.dam...@optusnet.com.au>
Subject Re: access a character column from a CMP EJB
Date Tue, 23 May 2006 13:15:40 GMT
Hi Vasily,

This problem is fixed in Geronimo 1.0.

Thanks,
Gianny


Zakharov, Vasily M wrote:

>Hi, Gianny,
>
>I have a problem that looks similar to the one described below, and I've
>just stumbled upon your message in Google.
>
>The question I have is whether the bug described is still actual for
>Geronimo 1.0? 
>
> Vasily
>
>
>
>Hi Deepesh,
>
>This is a bug: no binding was defined for the Java primitive type char
>or the sql type CHAR. A fix has just been committed to fix this problem.
>Unfortunately, this means that you will need to checkout and build
>OpenEJB and TranQL. 
>
>The other approach is to write a custom org.tranql.sql.TypeConverter
>handling the type conversions Character <-> String. It looks like (not
>tested): 
>
>public class CharacterToStringConverter implements TypeConverter {
>public Object convertJavaToSQLType(Object opaque) throws
>TypeConversionException { 
>       Character value = (Character) opaque;
>       if (null == value) {
>           return null;
>       }
>       return character.toString();
>   }
>public Object convertSQLToJavaType(Object opaque) throws
>TypeConversionException { 
>       String value = (String) opaque;
>       if (null == value || 0 == value.length()) {
>           return null;
>       }
>       return new Character(value.charAt(0));
>   }
>}
>
>Then, you need to use it like this::
><sql-type>VARCHAR</sql-type>
><type-converter>CharacterToStringConverter</type-converter>
>
>Thanks,
>Gianny
>
>
>
>
>On 18/10/2005 2:31 PM, Deepesh wrote:
>
>Hi,
>
> I forget to post the full stack trace.
>
>here is the full stack trace without adding the
><sql-type>CHAR</sql-type>
><type-converter>org.tranql.sql.typeconverter.SerializableConverter</type
>-converter> 
>
>in openejb-jar.xml
>
>Caused by: org.tranql.ql.QueryException: Error
>executing statement: SELECT U.ACTIVE_FLAG FROM User U
>WHERE U.USER_ID = ?
>       at
>org.tranql.sql.jdbc.JDBCQueryCommand.execute(JDBCQueryCommand.java:79)
>       at
>org.tranql.cache.QueryFaultHandler.fieldFault(QueryFaultHandler.java:56)
>       at
>org.tranql.ejb.CMPFieldFaultTransform.get(CMPFieldFaultTransform.java:48
>)
>       ... 51 more
>Caused by: org.tranql.sql.TypeConversionException
>       at
>org.tranql.sql.typeconverter.SerializableConverter.convertSQLToJavaType(
>SerializableConverter.java:60)
>       at
>org.tranql.sql.jdbc.binding.TypeConverterBinding.getValue(TypeConverterB
>inding.java:81)
>       at
>org.tranql.sql.jdbc.binding.TypeConverterBinding.getValue(TypeConverterB
>inding.java:85)
>       at
>org.tranql.sql.jdbc.JDBCQueryCommand.execute(JDBCQueryCommand.java:72)
>       ... 53 more
>
>Regards,
>Deepesh
>
>
>
>  
>



Mime
View raw message