-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SaveOrUpdate
PostPosted: Mon Jan 09, 2006 4:14 pm 
Regular
Regular

Joined: Thu Sep 23, 2004 11:53 am
Posts: 83
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0
Mapping documents:
NA
Code between sessionFactory.openSession() and session.close():
NA
Full stack trace of any exception that occurs:
NA
Name and version of the database you are using:
NA
The generated SQL (show_sql=true):
NA
Debug level Hibernate log excerpt:
NA

If I write this...

session = ... create session
t = .. create transaciotn
Item item = new Item();
Set events = new HashSet();
events.add(new Event());
events.add(new Event())
item.setEvents(events);
session.save(item);
t.commit();

if I have cascade=persist,merge, save-update will this create new entries in the Events table and one entry in the Item table?

or do I have to

session = ... create session
t = .. create transaciotn
Item item = new Item();
session.save(item);
Set events = new HashSet();
events.add(new Event());
events.add(new Event())
item.setEvents(events);
session.save(item);
t.commit();

What I would like to happen is for hibernate to create al entries by calling save once. Just want to clear this up in my head.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 09, 2006 4:33 pm 
Regular
Regular

Joined: Thu Sep 23, 2004 11:53 am
Posts: 83
okay, someone thump me if I am wrong, but in order for the orignal example to work I must have cascade=persist,merge, save-update on both ends.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.