-->
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: Maps whose keys are entities and values entity lists?
PostPosted: Wed Dec 27, 2006 2:11 pm 
Newbie

Joined: Wed Dec 27, 2006 1:43 pm
Posts: 2
Hello!

Can anyone help me with maps of Lists of entitys? Is this possible in Hibernate? I have three classes:

public class Room {
private String name; // this is assigned key
// other data
}

public class Student {
private String identifier; // this is assigned key
// other data
}

public class Exam {
private Integer id; // this is key
private Map<Room,List<Student>> schedule = new HashMap<Room, List<Student>>(50);

/*
* What X-doclet tags to put here?
*/
public Map<Room,List<Student>> getSchedule() {
return schedule;
}
}

In database, I expect a table "schedule" like this:

create table schedule (
exam_id bigint not null,
room_id varchar(30) not null,
list_index integer not null,
student_id varchar(30) not null,
primary key(exam_id, room_id, list_index)
);

What X-doclet tags should I put in description of Exam.getSchedule to achieve this; ie. to Hibernate use it as expected?

Thanks!


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.