openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: [Newbie] Dirty/Changed Entities
Date Thu, 25 Jun 2009 16:31:08 GMT
Roger -

I'd highly recommend the Pro EJB 3 book [1].

-Rick

[1] http://www.amazon.com/Pro-EJB-Java-Persistence-API/dp/1590596455

On Thu, Jun 25, 2009 at 12:07 PM, Roger <roger.varley@googlemail.com> wrote:

> On Thursday 25 June 2009 16:27:20 Daryl Stultz wrote:
> > On Wed, Jun 24, 2009 at 4:22 PM, Roger <roger.varley@googlemail.com>
> wrote:
> > >  is there a way
> > > through the "enhanced" version to detect which entities have been
> changed
> > > so I
> > > don't call persist() for them,
> >
> > Well, since no one else has replied, I might be able to help. Try this:
> > OpenJPAEntityManager openJpaEm = (OpenJPAEntityManager) em;
> > assertTrue(openJpaEm.isDirty(entity));
> >
>
> Is it ok to do that? Shouldn't I be working through the generic Persistence
> API rather than "tying" myself to the specific implementation?
>
>
>
> > > or do I persist() them all and trust openJpa to
> > > only physically persist entities that have changed?
> >
> > First I assume you mean merge() rather than persist() as persist() is
> > something you do with new entities.
> >
>
> I am more of a newbie than I thought then. I thought merge() was something
> that you did when you had a "disconnected entity. Are there any good
> tutorials
> online anywhere for beginners - I find the openjpa manual a bit turgid and
> assumes that I know more about things than I actually do
>
> Regards
>

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