Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-dev] EIS OneToMany issue

User questions can be posted to either the EclipseLink forum,


or the user mailing list,




The dev mailing list is solely for development usage.


For your error, OneToMany mappings in NoSQL cannot use a mappedBy, this is solely a relational option.

A OneToMany in NoSQL is typically stored as a collection of ids in the source object.  So remove the mappedBy, you can set the field using @JoinField.

It is possible to map a OneToMany using a query, but not through annotations, you would need to customize the EISOneToOneMapping in a DescriptorCustomizer to set a selectionQuery.


What NoSQL database are you using?  How is your data structured?



From: Julien Ruaux [mailto:jruaux@xxxxxxxxx]
Sent: March-26-12 1:28 AM
To: eclipselink-dev@xxxxxxxxxxx
Subject: [eclipselink-dev] EIS OneToMany issue



I'm sorry for posting this on the dev list, but eclipselink-users seems to be down at the moment.
Congratulations on a great ORM fr! amework, I'm very interested in the EIS support offered by EclipseLink.
I am encountering this issue with the one-to-many relationship using the latest org.persistence.core from svn :

Caused by: java.lang.ClassCastException: org.eclipse.persistence.eis.mappings.EISOneToOneMapping cannot be cast to org.eclipse.persistence.mappings.OneToOneMapping

at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.OneToManyAccessor.processOneToManyMapping(

My model is pretty simple - an Album has many Tracks, and since my EIS records do not support collections I would like the foreign key to be on the target (Track) :
@NoSql(dataFormat = DataFormatType.MAPPED)
public class Album {

public String id;

@OneToMany(mappedBy = "album")
public List<Track> tracks;
@NoSql(dataFormat = DataFormatType.MAPPED)
public class Track {

public byte[] id;

public int number;

public String name;

public Album album;

Any idea what I might be doing wrong?



Back to the top