Hello,
My question is how can I update an existing Entity instead of creating
a new one. When I use my persist method in my Entity I always create a
new Entity in my DB whith a new Id, even when the object passed in my
persist method has an existing Id.
Im using Editors and RequestFactory, the save/flush/persist flow works
because it is saving data on the BD.
Perhaps I need something like a if() find() method and then something
like entityManager.itemFound.persist(newItem)???
I have the server Entity Articulo with the Id declared as:
{....
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
....}
This is my persist method on the server:
public void persistArticulo(Articulo articulo)
{
try {
EntityManager entityManager = entityManager();
entityManager.getTransaction().begin();
entityManager.persist(articulo);
entityManager.getTransaction().commit();
entityManager.close();
return ;
}
catch (Exception e)
{
e.printStackTrace();
return ;
}
}
Thanks a lot
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.