wood burning stoves*
The moose likes JDBC and the fly likes CONSTRAINT clause help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "CONSTRAINT clause help" Watch "CONSTRAINT clause help" New topic
Author

CONSTRAINT clause help

Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

I am trying to create a table that has a couple of unique fields like so

Where containableGraphics is another table with the fields ID and ParentID. I am trying to say that Position(s) are UNIQUE with respect to each Parent. But I don't think this type of constraint will work. I can always do this;


But I didnt want to redundantly enter the ContainerID when this info is also referred to by the containableGraphics ID since a containableGraphics can have only 1 parent which is a containerGraphics.
Any ideas on this??
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: CONSTRAINT clause help
 
Similar Threads
Hibernate tool code generation org.hibernate.MappingException: Foreign key
Replacing *.hbm.xml files with @Annotations.
Syntax error for Access Database
Composite Foreign Key that maps to Unique Constraint
Hypersonic DB question