Uploaded image for project: 'Spring Data for Apache Cassandra'
  1. Spring Data for Apache Cassandra
  2. DATACASS-652

Loading Enums using their ordinal fails

    XMLWordPrintable

    Details

      Description

      Persisting enums as ordinals not working, uses string instead of int in statement

      According to Example 1. Enum mapping to numeric types from the spring-data-cassandra-mapping documentation (https://github.com/spring-projects/spring-data-cassandra/blob/master/src/main/asciidoc/reference/mapping.adoc) the attached minimal example should be able to store and retrieve enums as ordinals to and from Cassandra.

      But when running ./gradlew test, the following error occurs:

      enumtest.PersistenceTest > test save FAILED
      {{ org.springframework.data.cassandra.CassandraInvalidQueryException: SessionCallback; CQL [INSERT INTO thing (thingid,some) VALUES (1,'FOO');]; Expected 4 or 0 byte int (3); nested exception is com.datastax.driver.core.exceptions.InvalidQueryException: Expected 4 or 0 byte int (3)}}

      So, it incorrectly tries to persist the enum as string ('FOO') foo, despite having the following annotation: @CassandraType(type = DataType.Name.INT)

       

        Attachments

          Activity

            People

            Assignee:
            mp911de Mark Paluch
            Reporter:
            tobias_hermann Tobias Hermann
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 39 weeks, 3 days ago