Then add @*to*(cascade=CascadeType.PERSIST), it will take you 2 mins to do what you really like and you will know you do it.

Or even faster, add the stupid
<entity-mappings>
  <persistence-unit-metadata>
    <persistence-unit-defaults>
      <cascade-persist/>
    </persistence-unit-defaults> 
  </persistence-unit-metadata>
</entity-mappings>
in your orm.xml file and you are good to go.

I really like smoking Chicha when drinking tea. Not sure it should be enforced to everyone. Not sure if I should do it every time either.

On  Mar 4, 2009, at 12:54, Dan Allen wrote:



On Tue, Mar 3, 2009 at 8:10 AM, Emmanuel Bernard <emmanuel@hibernate.org> wrote:

On  Feb 28, 2009, at 08:08, Max Rydahl Andersen wrote:


2) What default do you think we should use for reveng, ALL or NONE (or something else ?)

none

What about PERSIST? I really like to be able to do this.

Child c1 = new Child();
Child c2 = new Child();
Parent p = new Parent();
p.addChild(c1);
p.addChild(c2);
em.persist(p);

With none, you have to go through and do persists all over the place...and in a real application, that top level object typically has 10+ relationships, esp if lookup tables are used.

-Dan

--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action

http://mojavelinux.com
http://mojavelinux.com/seaminaction

NOTE: While I make a strong effort to keep up with my email on a daily
basis, personal or other work matters can sometimes keep me away
from my email. If you contact me, but don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters.  Please don't hesitate to resend a message if
you feel that it did not reach my attention.