-
Dec 8th, 2011, 07:24 PM
#1
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.
-
Dec 8th, 2011, 10:55 PM
#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?
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
-
Forum Rules