-->
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.  [ 2 posts ] 
Author Message
 Post subject: Collection of "any type" ?
PostPosted: Fri Dec 05, 2003 8:45 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Hey,

my problem is as follow:

I have a class A which has one "property" called value, which should
be any type of object respectively has a reference to any kind of object!
(sorry for my english!)

It could be a a basic type(like string), any (selfdefined) object or a collection of one of these objects!

So far, i use "any type mapping" :

Code:
<any name="value" id-type="long"   cascade="all">
  <column name="class_name"/>
  <column name="class_id" />
</any>

so i just had a reference to the "value-object"!
It works well for "any kind of object" and for the basic types (with wrapper classes)!


But what about a collection of objects ?

I could solute this, with writing a class B which has a one-to-many relationship with class C!
Class C hold the references of the "true" objects.
Class D is referenced by the value of class A.

But it seems to be a little bit confused!
There's certainly an better way, but i'm confused of reading chapter6 & 7 again and again and test some different ways...

I would be grateful for hints..


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 05, 2003 9:32 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
many-to-any

However, you cannot keep in one property an any semantic and an many-to-any semantic. In other words, it's not possible to map an object AND collection in the same property.

_________________
Emmanuel


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