This week's book giveaway is in the Cloud forum.
We're giving away four copies of The Business Blockchain and have William Mougayar on-line!
See this thread for details.
Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement this contraint at the mapping file level ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic