Hello there,
I'm trying to use EclipseLink 2.4.0 with MongoDB 2.2 on JBoss AS 7.1.1.
All works fine but I ran into a error trying to do something very simple.
I have 2 entities AttachmentRequest (A) and Account (B).
A have a relation with B declared like that :
@Entity
@NoSql(dataType="ATTACHMENT_REQUEST", dataFormat=DataFormatType.MAPPED)
public class AttachmentRequest extends JPAMongoBaseToVoConvertible {
@Id
@Field(name="_id")
@GeneratedValue
private String id;
...
// Relations
// The emitter of this AttachmentRequest. Must be unique and present
@OneToOne(targetEntity=Account.class)
private Account emitterAccount=null;
...
@Entity
@NoSql(dataType="account", dataFormat=DataFormatType.MAPPED)
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "email"))
public class Account extends JPAMongoBaseEntity {
@Id
@Field(name="_id")
@GeneratedValue
private String id;
I create successfully the A entity and link successfully with a B entity (verified directly in MongoDB).
Now I just to list all A having a B.id = parameter.
I do a request like this :
TypedQuery<AttachmentRequest> q = em.createQuery("Select ar from AttachmentRequest ar join ar.emitterAccount em where em.id=:emitterId", AttachmentRequest.class);
q.setParameter("emitterId", emitterId);
AttachmentRequest ar = q.getSingleResult();
The result is this exception :
[EL Warning]: 2013-02-14 18:37:11.454--UnitOfWork(1885572122)--Exception [EclipseLink-6168] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.QueryException
Exception Description: Query failed to prepare, unexpected error occurred: [java.lang.ClassCastException: org.eclipse.persistence.eis.mappings.EISOneToOneMapping cannot be cast to org.eclipse.persistence.mappings.OneToOneMapping].
Internal Exception: java.lang.ClassCastException: org.eclipse.persistence.eis.mappings.EISOneToOneMapping cannot be cast to org.eclipse.persistence.mappings.OneToOneMapping
Query: ReadAllQuery(referenceClass=AttachmentRequest jpql="Select ar from AttachmentRequest ar join ar.emitterAccount em where em.id=:emitterId")
Any help would be great appreciated because I'm blocked on this issue for 2 days.
Thank's in advance