openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: Null field values after calling EntityManager.remove()
Date Thu, 29 Apr 2010 15:20:09 GMT
Section "3.2.3 Removal" of the 2.0 spec states:

"After an entity has been removed, its state (except for generated state)
will be that of the entity at the
point at which the remove operation was called."

Please go ahead and open a JIRA [1] for this issue.

[1] http://issues.apache.org/jira/

-- 
Thanks,
Rick

On Thu, Apr 29, 2010 at 6:14 AM, leoisiah <leoisiah@yahoo.com> wrote:

>
> For example, I have an entity class named User. I persist and then remove
> an
> instance of User.
>
> //
> // EntityManager em is initialized before the following code
> //
>
> em.getTransaction().begin();
> User user = new User();
> user.setName("name1");
> em.persist(user);
> em.getTransaction().commit();
> System.out.println(user.getName); // will print out name1
> em.getTransaction().begin();
> em.remove(user);
> em.getTransaction().commit();
> System.out.println(user.getName); // will print out null (oh no!)
>
> After I persist and remove the same instance of User, it's fields became
> null. I believe this is expected behavior, but is there a way that I might
> be able to retrieve the original values of the fields?
>
> Thanks.
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Null-field-values-after-calling-EntityManager-remove-tp4979489p4979489.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

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