-->
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 Object of different types
PostPosted: Mon Apr 19, 2004 7:02 pm 
Regular
Regular

Joined: Mon Apr 19, 2004 6:54 pm
Posts: 79
Hi,

Is it possible to have a collection that holds objects of different types?
Of course, the types will be hibernate compliant (base types or persistent classes).
If yes, how do you declare such a collection?

Thanks

Christophe

/**
* @hibernate.class table="MyClasses"
/*
MyClass {
Map _properties;

/**
* @hibernate.map name="Properties"
* how do i declare the mapping
*/
public Map getProperties() {
return _properties;
}

public void setProperties(Map properties) {
_properties = properties
}

public void addProperty(String name, Object value) {
_properties.put(name, value);
}
....
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 7:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Check the documentation on the Any mapping, eg sec 5.2.5.

"The <any> mapping element defines a polymorphic association to classes from multiple tables. This type of mapping always requires more than one column. The first column holds the type of the associated entity. The remaining columns hold the identifier."


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.