Hi. My domain objects has a Category object. This Category object has two relationshipts : parentCategory and childCategories (actually, I'm using CeveatEmptor Category class). But there is a requirment, no two categories have the same name at the same level (same level here means the same categetory parent). Well, CeveatEmptor Category.hbm.xml has the following :
I tried the following : insert into category values (1, 0, "Computer", null); insert into category values (2, 0, "Software", 1); insert into category values (3, 0, "Porgramming", 2); insert into category values (4, 0, "Databases", 2); Here, at the forth line I got an exception about breaking FK contraint. Any help how to implement my requirement (at the mapping level if possible) ? (I'm not SQL guru) BTW, what unique-key attribute means ? Thanks.