Results 1 to 2 of 2

Thread: MongoDB Cross Store - Refer a collection of documents in JPA Entity Bean?

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Question MongoDB Cross Store - Refer a collection of documents in JPA Entity Bean?

    I've found that the annotation @RelatedDocument can only backing a plain object to the MongoDB document. It I declare it before a List field, for example:
    @Entity
    class Club {
    @RelatedDocument
    private List<Person> members;
    ....
    }

    @Document
    class Person {
    ...
    }

    The ClassCastException will throw at runtime:
    java.lang.ClassCastException: com.mongodb.BasicDBObject cannot be cast to com.mongodb.BasicDBList
    at org.springframework.data.mongodb.core.convert.Mapp ingMongoConverter.writeInternal(MappingMongoConver ter.java:346)
    at org.springframework.data.mongodb.core.convert.Mapp ingMongoConverter.write(MappingMongoConverter.java :316)

    How can I deal with this problem? Thanks.

  2. #2
    Join Date
    Dec 2011
    Posts
    2

    Default

    In Spring Data's MongoDB core mapping package, there is a @DBRef annotation which can embed a collection in a document. So, does cross store provide the similar capacity?

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
  •