users@glassfish.java.net

Re: packaging strategy:best practice

From: <glassfish_at_javadesktop.org>
Date: Wed, 16 May 2007 15:39:41 PDT

Ketan,

To create a new entity you can use that entity's constructor:
Person p = new Person(x, y, z);

To make any entity persistence, you'll just call em.persist(e). If all entities are not related, you can pass an EM instance into the constructor to call persist(). Otherwise, it's better to create all related entities, set the relationships, and then call a single persist() on the root entity (assuming that all CASCADE flags are set correctly).

Regards,
-marina
[Message sent by forum member 'mvatkina' (mvatkina)]

http://forums.java.net/jive/thread.jspa?messageID=217518