Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » DoesExistQuery in nosql(DoesExistQuery not yet implemented)
DoesExistQuery in nosql [message #1018856] Thu, 14 March 2013 15:17 Go to next message
Johan Vos is currently offline Johan Vos
Messages: 1
Registered: March 2013
Junior Member
I am working with Eclipselink 2.5.0-SNAPSHOT with nosql support (trunk
code from git).
Arun's simple example
at blogs.oracle.com/arungupta/entry/java_ee_6_and_nosql is
working, but my own code using @ManyToOne was not working. I dove in
the eclipselink source code, and it seems that persisting an object
with a @ManyToOne annotation to another object only works if the
referred object has been made persistent in the same JPA session. In
that case, the referred object is added to the clonemap in
org/eclipse/persistence/internal/sessions/UnitOfWorkImpl, and the
clonemap is checked for all object fields in an object before that one
is made persistent. If one of the objects is not in the clonemap
(UnitOfWorkImpl.isObjectRegistered() returns false), a DoesExistQuery
will be executed, and this query is not yet supported in
MongoPlatform.java.

In my example, a user is registered and stored in a mongo db. That
works fine. Later (after stopping/starting the server), the user has
to login again, and the User object is successfully retrieved from the
mongo db (using a NamedQuery, works fine). Next, a Content object is
created with the given User on the .author field. Storing that Content
object fails due to "DoesExistQuery is not supported".

Is there a workaround for this, or do I wait till DoesExistQuery is implemented?
Re: DoesExistQuery in nosql [message #1020599 is a reply to message #1018856] Mon, 18 March 2013 14:41 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Sounds like you are mixing managed and detached objects? You should not do this in JPA in general, regardless of NoSQL.

You should first persist the Context object, or if it is existing, read it from the current persistence context.

Is your relationship cascade persist?

You could log a bug that the DoesExistQuery is not auto generated, this should be possible for most NoSQL platforms. You could also define your own DoesExistQuery using a DescriptorCustomizer.


James : Wiki : Book : Blog : Twitter
Previous Topic:Memory issue due to hard referenced entities
Next Topic:JOIN Syntax Worked in toplink essentials
Goto Forum:
  


Current Time: Thu Oct 02 08:28:53 GMT 2014

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

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