Uploaded image for project: 'Apache MetaModel'
  1. Apache MetaModel
  2. METAMODEL-1190

ClassCastException when getting value from DB

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.0.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      We use MetaModel with Postgres/MsSQL in our project and when system processes many data and queries DB tables in parallel then queuries suddenly fails with exception like this
      'java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Boolean'.

      This exception is thrown when org.apache.metamodel.data.Row.getValue(Column) is executed and result is to be saved to variable. The problem occurs time and again.
      It looks like that AbstractRow.getIndex(Column) which is invoked in getValue(Column) returns wrong column index and that's why value of another column is get.

      I think the cause of problem is in org.apache.metamodel.data.CachingDataSetHeader.indexOf(Column) which uses System.identityHashCode(Object) for generating keys. This method can return the same values for different objects.

      Attached is testing class which reproduces problem.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pknapek Petr Knápek
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: