User questions can be posted to either the EclipseLink forum,
http://www.eclipse.org/forums/index.php/f/111/
or the user mailing list,
eclipselink-users@xxxxxxxxxxx
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
Hi,
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(OneToManyAccessor.java:207)
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) :
---------------------
@Entity
@NoSql(dataFormat = DataFormatType.MAPPED)
public class Album {
@Id
public String id;
@OneToMany(mappedBy =
"album")
public List<Track> tracks;
}
---------------------
@Entity
@NoSql(dataFormat = DataFormatType.MAPPED)
public class Track {
@Id
@GeneratedValue
public byte[] id;
public int number;
public String name;
@ManyToOne
public Album album;
}
---------------------
Any idea what I might be doing wrong?
Thanks,
Julien