Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2631

Can no longer use "byte[]" as root of scalar SQLSelect

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.RC1
    • Fix Version/s: 4.1.RC2, 4.2.M1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Derby DB (this fails in a test), Cayenne 4.1.RC1

      Description

      Just switched from 4.0.x to 4.1.RC1. The following query that worked before started printing warnings and throwing an exception:

      // "bytes" 
      byte[] bytes = SQLSelect
      	.scalarQuery(byte[].class, "SELECT bytes FROM sometable")
      	.selectOne(context);
      
      o.a.c.a.t.SerializableTypeFactory: Haven't found suitable ExtendedType for class 'byte[]'. Most likely you need to define a custom ExtendedType.
      o.a.c.a.t.SerializableTypeFactory: SerializableType will be used for type conversion.
      o.a.c.l.JdbcEventLogger: *** error.
      java.io.StreamCorruptedException: invalid stream header: 79FC63D0
      at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:808)
      at java.io.ObjectInputStream.<init>(ObjectInputStream.java:301)
      at org.apache.cayenne.access.types.SerializableTypeFactory$SerializableType.toJavaObject(SerializableTypeFactory.java:106)
      at org.apache.cayenne.access.types.SerializableTypeFactory$SerializableType.toJavaObject(SerializableTypeFactory.java:70)
      at org.apache.cayenne.access.types.ExtendedTypeDecorator.materializeObject(ExtendedTypeDecorator.java:53)
      at org.apache.cayenne.access.jdbc.reader.ScalarRowReader.readRow(ScalarRowReader.java:50)
      

      The cause seems to related to the incorrect class name extraction for "byte[]" class, so extended type lookup is failing.

        Attachments

          Activity

            People

            • Assignee:
              ntimofeev Nikita Timofeev
              Reporter:
              andrus Andrus Adamchik
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: