From: <glassfish_at_javadesktop.org>
Date: Tue, 10 Nov 2009 01:19:58 PST
Entitymanager attaches the Entity to the persistence context when you're doing persist().
As the Stock Entity you are edit()ing isn't attached, the Entitymanager is treating it as a new Entity and creates it.
What you need to do is return the attached Entity in create():
public Stock create(Stock stock) {
em.persist(stock);
return Stock
}