Reputation: 2679
We're trying to do a @OneToMany and @ManyToOne relation with EclipseLink/MongoDB:
The @OneToMany declaration looks like this:
@Entity
@NoSql(dataType = "ServiceCatalog", dataFormat = DataFormatType.MAPPED)
public class ServiceCatalog {
@Id
@GeneratedValue
@Field(name = "_id")
private String id;
@OneToMany
private List<ServiceCatalogNeedCategory> serviceCatalogNeedCategories;
…
On the other side, the @ManyToOne declaration:
@Entity
@NoSql(dataType = "NeedCategory", dataFormat = DataFormatType.MAPPED)
public class ServiceCatalogNeedCategory {
@Id
@GeneratedValue
@Field(name = "_id")
private String id;
@Field(name = "title")
private String Title;
@ManyToOne(fetch=FetchType.LAZY)
private ServiceCatalog serviceCatalog;
...
The above configuration leads to the following error: org.eclipse.persistence.eis.mappings.EISOneToOneMapping cannot be cast to org.eclipse.persistence.mappings.OneToOneMapping
We really need to be able to resolve both directions.
Cheers Michael
Upvotes: 0
Views: 1760
Reputation: 18379
Please include the full exception stack.
There was an issue fixed in the 2.6 dev stream for NoSQL, it may be related.
https://twitter.com/j_b_sutherland/status/339727557928833025
What version are you using, I would try at least 2.5, or a recent 2.6 dev build.
Upvotes: 1
Reputation: 8333
You missed the MappedBy Annontation on the OneToMany side. See http://www.objectdb.com/api/java/jpa/OneToMany
[edit]
OMG it's NOSQL sorry.
ORM are no more what they used to be..
I don't know so, but if you're really using JPA API then it might be the trick
Upvotes: 0