Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EIS OneToMany issue
EIS OneToMany issue [message #830000] Tue, 27 March 2012 03:42 Go to next message
Julien Ruaux is currently offline Julien RuauxFriend
Messages: 1
Registered: March 2012
Junior Member
I'm reposting this thread which started on the eclipse-dev mailing list.


James, I added a @Customizer to my Album class which calls setCustomSelectionQuery(readAllQuery) but my query is never called.
I'm not sure what to do next, so I'm attaching my code so far.

The datagrid I'm using is TIBCO ActiveSpaces. The structure looks like this :

space Album:
- ID (String)

space Track:
- ID (byte[])
- NAME (String)
- NUMBER (int)
- ALBUM_ID (String)


Thanks for your help,
Julien


From: James Sutherland <JAMES.SUTHERLAND@xxxxxxxxxx>
Date: Mon, 26 Mar 2012 05:43:49 -0700 (PDT)
Delivered-to: eclipselink-dev@eclipse.org
Subject: [eclipselink-dev] EIS OneToMany issue

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
Re: EIS OneToMany issue [message #834890 is a reply to message #830000] Mon, 02 April 2012 14:26 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

How are you using TIBCO ActiveSpaces? Do you have your own EISPlatform and your own JCA adapter? Can you include these?

Does TIBCO ActiveSpaces support querying, what kind of data format does it support?
If it is a data grid, then it would probably be much more efficient to store a collection of trackIds in the Album, than query the entire grid for tracks with the albumId, or even better, just store the tracks with the Album instead of separately.

Your selectionCriteria is not a valid expression (expression must be conditional, and use an ExpressionBuilder), but that doesn't matter unless you have implemented some kind of dynamic querying support for TIBCO. Normally the setCustomSelectionQuery would be a query that uses a native EISInteraction.


James : Wiki : Book : Blog : Twitter
Previous Topic:@OrderColumn on inverse @ManyToMany + @JoinTable question
Next Topic:JDBC_SEQUENCE_CONNECTION_POOL deprecated but alternative not working
Goto Forum:
  


Current Time: Fri Apr 19 20:17:29 GMT 2024

Powered by FUDForum. Page generated in 0.03008 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top