Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000871 [Resin] major always 01-17-06 10:06 02-02-06 10:09
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.0.17
Summary 0000871: Wrong datatype used when EJB container creates an instance with a null LONGVARBINARY column
Description I have an Oracle table with a LONG RAW column that's allowed to be null. My resin.ejb has the following definition for the field:

            <cmp-field>
                <field-name>methodParametersByteArrayField</field-name>
                <sql-column>methodparameters</sql-column>
                <abstract-sql-type>LONGVARBINARY</abstract-sql-type>
                <sql-type>LONG RAW</sql-type>
            </cmp-field>

But the following code gets generated in the __Amber.java file:

    if (__caucho_super_get_methodParametersByteArrayField() == null)
      pstmt.setNull(index++, java.sql.Types.DECIMAL);
    else
      pstmt.setBytes(index++, __caucho_super_get_methodParametersByteArrayField());

When I try to create a bean instance where the field in question is null, the JDBC call throws an exception with a message from Oracle, "expected BINARY but found NUMBER". Clearly the setNull() call shouldn't be using java.sql.Types.DECIMAL as its data type.
Additional Information
Attached Files

- Relationships

- Notes
(0000722)
koreth
01-17-06 11:06

Patch:

--- modules/resin/src/com/caucho/amber/type/ByteArrayType.java.orig 2006-01-17 10:51:51.266923262 -0800
+++ modules/resin/src/com/caucho/amber/type/ByteArrayType.java 2006-01-17 10:51:55.022416994 -0800
@@ -92,7 +92,7 @@
     throws IOException
   {
     out.println("if (" + value + " == null)");
- out.println(" " + pstmt + ".setNull(" + index + "++, java.sql.Types.DECIMAL);");
+ out.println(" " + pstmt + ".setNull(" + index + "++, java.sql.Types.BINARY);");
     out.println("else");
     out.println(" " + pstmt + ".setBytes(" + index + "++, " + value + ");");
   }
 
(0000842)
ferg
02-02-06 10:09

ejb/06jn
 

- Issue History
Date Modified Username Field Change
01-17-06 10:06 koreth New Issue
01-17-06 11:06 koreth Note Added: 0000722
01-17-06 11:09 koreth Issue Monitored: koreth
02-02-06 10:09 ferg Note Added: 0000842
02-02-06 10:09 ferg Assigned To  => ferg
02-02-06 10:09 ferg Status new => closed
02-02-06 10:09 ferg Resolution open => fixed
02-02-06 10:09 ferg Fixed in Version  => 3.0.18


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker