Announcement Announcement Module
Collapse
No announcement yet.
MongoDB Cross Store - Refer a collection of documents in JPA Entity Bean? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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?

    Comment

    Working...
    X