openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: Problem of partial commit in OpenJPA
Date Wed, 14 Apr 2010 13:48:46 GMT
On Tue, Apr 13, 2010 at 2:08 PM, Ravi P Palacherla <
ravi.palacherla@oracle.com> wrote:

>
> Kevin,
>
> In sudhir's code snippet, aDepartment is persisted and
> aDepartment.getName()
> is used in the find.
> I guess  aDepartment will be managed after the persist statement and the
> find will always return a non-null object. So, I think that newDept should
> never be null.
>
> Is my understanding incorrect ?
>

Ravi,
Right.  I couldn't quite figure out under what conditions a non-null
department would be returned.  But, since the Department entity wasn't
provided, maybe the key generation had some anomaly that caused a problem
with the find operation.  Not sure.  I decided to just focus on the partial
commit problem rather than the app itself...  :-)

Related to that though is the final persist() call in the sample app.  If
newDept was found, then it is already managed by the persistence context.
And, since it was already an existing entity, it doesn't make any sense to
be performing a persist() operation.  This should actually result in an
EntityExistsException.  Even a merge() in this case would not be necessary
since the entity is already merged.

So, maybe there are more issues with the app that need to resolved...

Kevin


>
> Regards,
> Ravi.
> --
> View this message in context:
> http://n2.nabble.com/Problem-of-partial-commit-in-OpenJPA-tp4891679p4897872.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message