Hi,
I'm trying to map some existing tables with Hibernate.
It's quite simple: we've got categories that have names in multiple languages.
The DDL is as follows:
create table language (
id integer not null auto_increment,
code varchar(2) not null,
unique (code),
primary key(id)
);
create table category (
id integer not null auto_increment,
parent_id integer default null,
ordr integer not null default 99,
primary key (id)
);
create table category_description (
category_id integer not null,
language_id integer not null,
title varchar(255) not null,
constraint foreign key (category_id) references category(id),
constraint foreign key (country_language_id) references country_language(id),
primary key (category_id, country_language_id)
);
Now I'd like to have a map with Language as it's key and Description (table category_description) as it's value, like this:
private Map<Language, CategoryDescription> descriptions = new HashMap<Language, CategoryDescription>();
Can anyone provide me with some pointers on this? I've tried the example as given on page 311/312 from the 'Java Persistence with Hibernate' which resembles my problem but I'm just not getting it :(