Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to implement this contraint at the mapping file level ?

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • 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.
 
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic