-->
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: How to annotate a map with entity-list as value?
PostPosted: Thu May 03, 2007 5:41 am 
Newbie

Joined: Thu May 03, 2007 5:26 am
Posts: 1
Hi,

I've a problem of how to define the database-mapping using annotations for the following problem:

@Enitity
class FooBar{

@Id
@GeneratedValue
Long id;

@???? which one here ????
protected Map<Integer, List<FooBar>> childs = new HashMap<Integer, List<FooBar>>();

//....
}

I've worked (to some part) through Bauers "Java Persistence", but the section about Map-mapping (7.2.4) just handles the case of entities being the map-values. If the entities are within a list, the problem is obviously different, but I don't have any clue of how to define the data-base mapping here.

Any ideas? links to additional literature? similar examples?

Thanx in advance, best regards,
Watzlaw


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 7:30 am 
Senior
Senior

Joined: Tue Jul 25, 2006 9:05 am
Posts: 163
Location: Stuttgart/Karlsruhe, Germany
I don't think it is possible to map a Collection of Collections to the database, this means it is not possible to have a collection within another collection (i.e. a List within a Map).

Cheers,

Andy

_________________
Rules are only there to be broken


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.