persist() inserts "in-place" -- i.e., it inserts the record that you
call persist() on. merge() inserts a copy, so is less efficient.

remove() will result in a DELETE statement when the transaction commits.

-Patrick

On Jan 25, 2008 7:13 PM, Tim Watts <[EMAIL PROTECTED]> wrote:
> Hi,
>
> What's the difference between merge() and persist()?
>
> They both add the entity to the persistence context; both will insert the
> entity if necessary. merge() seems to insert/update as necessary. If so, then
> why would I ever need persist() since merge() can do everything it can do?
>
> Also, is remove() supposed to remove the entity from the database, the
> persistence context or both?
>



-- 
Patrick Linskey
202 669 5907

Reply via email to