-->
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.  [ 1 post ] 
Author Message
 Post subject: Composite Key and Cascade Save
PostPosted: Thu Mar 03, 2005 7:57 am 
Newbie

Joined: Thu Feb 24, 2005 8:49 am
Posts: 6
Hi,

My problem is something like the one discussed in Hibernate in Action book on page 335 related to composite key:

Say, we do have two objects

Code:
Oraganisation
{
   Id orgId;
   Set Users
}


Code:
UserID
{
   userName;
   orgID;
}

etc

userName and orgID are composite keys for object User, so the mapping gonna be

Code:
<class name="User" table="USER">
<composite-id  name=userID class=UserID>
    <key-property name=userName column=userName>
    <key-property name=orgID column=ORG_ID>
</composite-id>


My screen creates, Organisation along with its child objects and wants to save all its childs which means the Users.

My questions are:

1. Do I need to explictly set the orgID inside the UserID key during persistence?
2. How can I avoid the step 1, if it is must? I just want to do the cascade save of child objects along with parent when it is getting created?

Thanks,
Arshad













Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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

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.