-->
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: How to map a type safe collection class (non 1.5)
PostPosted: Fri Oct 01, 2004 10:39 am 
Regular
Regular

Joined: Fri Sep 03, 2004 2:01 pm
Posts: 51
Hibernate version:2.1.6

Is it possible to map the following using only 2 tables? :

Class A contains a single instance of a type safe collection class B (1..1 to 0..1), which in turn contains a java.util.Set with multiple data objects in it (4 properties per set entry)

We have class B for two reasons : 1.) its type safe, and 2.) if provides some state change logic checks.

Currently, Ive got A.hbm.xml containing a one-to-one reference to Class B

<one-to-one property-ref="A" cascade="save-update">

and in B.hbm.xml I have a <set> set up

<set name="foo" lazy="true">
<key column="a_id" foreign_key="FK_B_A"/>
<composite-element class="MySetEntryClass">
...
...
</composite-element>

However, this results in 3 tables:

1 for class A (which is ok)
1 for class B
1 for the collection mapping of B

Can I combine the 2nd and 3rd tables tables, and simply map this construct with 2 tables (some sort of custom user-implemented collection type)?

Nick


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.