-->
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: How to save an object to multiple tables?
PostPosted: Wed Jun 23, 2004 8:59 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:03 pm
Posts: 40
Hi,

I have a complex object, which has no equival table in my database schema.
This object is composed of another objects, which do have tables in dbs.
The question is, how to write an .xml mapping file, so that I will call:
myComplexObject.save()
and it will take all the subobject, and save them to the corresponding tables.
(I stucked up at the .xml file creation, ... do I need the table element for my complex object? (I have no table!)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 23, 2004 9:23 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:03 pm
Posts: 40
OK, I JUST want to know:

<class ...

Do I need to declare a 'table' property? (In fact I can't declare, becauce I have no table for this complex object)

<subclass >......</subclass>


</class>

p.s. sorry, if those questions are too trivial, but I'm really a newbie


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 8:54 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
You use the class/subclass mapping for defining object hierarchies that map at some level to tables - table per hierarchy, table per class etc.

If your complex object is composed of objects that are Hibernate objects, then your complex object does not have to be mapped to Hibernate itself. You would implement find, save etc in the complex object which would do the underlying Hibernate work. I would not model things this way, as I would rather use transactions and surf the object model as I needed, but I don't know your particular situation.


Sherman


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.