Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hi @all
dont know if it is possible but i try the following:
-----------------------------------------------------------------------
db-schema:
table: week
attributes: id, namekey
table: day
attributes, id, namekey
n:m relation between week and day => n:m table: week_days
table: week_days
with attributes: id (week), id (day), dinner (string)
-----------------------------------------------------------------------
now i try the annotated class Dinner
@Entity
@Table (name="dinners", schema="hotelmenu")
public class Dinner {
private Week week;
private Map<Day, String> htlDinners;
@ManyToOne
@JoinColumn(name = "week_id")
public Week getWeek() {
return this.week;
}
+setter for week
@ManyToOne
@JoinColumn (name= "day_id")
@MapKey (name= "day_id")
@Column (name = "wd_dinner") //for String in Map
public Map<Day, String> getHtlDinners () {
return htlDinners;
}
+setter for htlDinners
+equals & hash
}
is it possible to map a java.util.Map like this or am i missing something?
btw. what is the @MapKey stand for?
cheers manakin