-->
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.  [ 4 posts ] 
Author Message
 Post subject: Use of composite-id
PostPosted: Tue May 02, 2006 1:52 pm 
Newbie

Joined: Mon Apr 10, 2006 3:32 pm
Posts: 13
Hi:

When in my mapping document i have this:

<composite-id>
<key-property name="id" />
<key-many-to-one name="customer" column="customer_fk" class="customer" />
</composite-id>

My question is if i have to "put" or "establish" the two values to use the function load().


Thanks.....



Need help with Hibernate? Read this first:
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  
 
 Post subject:
PostPosted: Tue May 02, 2006 2:17 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
Create an object of type declared for the mapping file and populate the attributes id(type - int, string, ...) and customer( type- customer). Now use session.load() variations.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 2:21 pm 
Newbie

Joined: Mon Apr 10, 2006 3:32 pm
Posts: 13
But what happens if i dont "put" the id of the customer? The function load() works?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 02, 2006 3:40 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
If you dont provide complete information of your PrimaryKey, you will get the following error

org.hibernate.ObjectNotFoundException: No row with the given identifier exists


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.