-->
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.  [ 3 posts ] 
Author Message
 Post subject: Newbie has multiple classes contained in a single table
PostPosted: Tue Jun 07, 2005 8:25 pm 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
Hibernate 3.05. I saw nothing relevant in the FAQ or the manual, but I may not know the proper terminology to use to find what I need.

I have a table called ORDER and have successfully mapped it to a simple existing Java class.

Within the ORDER table are a number of fields related to a CUSTOMER, e.g.:

ORDER.CUST_FIRST_NAME
ORDER.CUST_LAST_NAME
...

I have an existing Customer class with appropriate fields to contain this data, contained inside the Order object:

Code:
class Order
{
    private int OrderId;

    private Customer customer;
    ...
}


How do I describe this mapping to Hibernate? I want to be able to fetch an order and access the embedded customer information by saying:

Code:
...
Customer cust = order.getCustomer();
...

order.update();   // Saves all ORDER fields, including the CUST fields if they've been modified

Thanks!

John


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 07, 2005 11:49 pm 
Regular
Regular

Joined: Thu May 26, 2005 2:08 pm
Posts: 99
http://www.hibernate.org/hib_docs/v3/re ... -component


Top
 Profile  
 
 Post subject: Thanks!
PostPosted: Wed Jun 08, 2005 1:46 am 
Newbie

Joined: Thu Jul 01, 2004 9:09 am
Posts: 16
Location: USA
I appreciate the help! Thanks!


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