Jak za pomocą JPA lub Hibernate Annotations sprawić by taka mapa:
class Tariff
{
// ...
Map<Test, Float> prices;
// ...
}
mapowała się na:
CREATE TABLE tariffs_tests_prices
(
tariff_id BIGINT NOT NULL
FOREIGN KEY REFERENCES tariffs,
test_id BIGINT NOT NULL
FOREIGN KEY REFERENCES tests,
price FLOAT NOT NULL,
PRIMARY KEY (tariff_id, test_id)
);