Results 1 to 2 of 2

Thread: @RooMongoEntity(identifierType = Binary.class)

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Default @RooMongoEntity(identifierType = Binary.class)

    I would like to use org.bson.types.Binary for the _id field as part of a RooMongoEntity, but that doesn't seem to be supported currently as I am getting the following exception:

    "Type org.bson.types.Binary does not meet the specification for type parameter 2 (ID extends java.io.Serializable) in generic type org.springframework.data.repository.PagingAndSorti ngRepository"

    I have tried spring-data-mongodb versions: 1.0.0.M5, 1.0.2.RELEASE, 1.1.0.M1.

    MongoTemplate itself works fine writing and reading DBObjects with _id fields of type org.bson.types.Binary.

    Has anyone been successful using org.bson.types.Binary for their _id field?

  2. #2
    Join Date
    Jul 2012
    Posts
    2

    Default

    This combination did the trick -- basically I upgraded to a version of the mongo-java-driver that has a serializable Binary type and excluded the mongo-java-driver that comes with the spring-data-mongodb artifact.

    <dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>2.8.0</version>
    </dependency>

    <dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-mongodb</artifactId>
    <version>1.0.2.RELEASE</version>
    <exclusions>
    <exclusion>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    </exclusion>
    </exclusions>
    </dependency>

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •