Good Morning,
My system automatically creates tables in my data base, but I possess a relation many-to-many in mine hibernate, which this creating the table in the data base thus:
Code:
CREATE TABLE "globalGIP"."dbo"."UsuariosGrupos"
(
usuario int,
grupo int,
CONSTRAINT "globalGIP"."dbo"."UsuariosGrupos"_PK PRIMARY KEY (usuario,grupo)
);
ALTER TABLE UsuariosGrupos
ADD CONSTRAINT FKF8D294AF242E4515
FOREIGN KEY (usuario)
REFERENCES Usuarios(idUsuario) ON DELETE NO ACTION ON UPDATE NO ACTION;
ALTER TABLE UsuariosGrupos
ADD CONSTRAINT FKF8D294AF3890D1CB
FOREIGN KEY (grupo)
REFERENCES Grupos(idGrupo) ON DELETE NO ACTION ON UPDATE NO ACTION;
But I need that my table was created thus:
Code:
CREATE TABLE "globalGIP"."dbo"."UsuariosGrupos"
(
usuario int,
grupo int,
CONSTRAINT "globalGIP"."dbo"."UsuariosGrupos"_PK PRIMARY KEY (usuario,grupo)
);
ALTER TABLE UsuariosGrupos
ADD CONSTRAINT FKF8D294AF242E4515
FOREIGN KEY (usuario)
REFERENCES Usuarios(idUsuario) ON DELETE Cascade ACTION ON UPDATE NO ACTION;
ALTER TABLE UsuariosGrupos
ADD CONSTRAINT FKF8D294AF3890D1CB
FOREIGN KEY (grupo)
REFERENCES Grupos(idGrupo) ON DELETE Cascade ACTION ON UPDATE NO ACTION;
As that I make for hibernate to create this relation where mine
DELETE
either
CASCADE e not
NO???? Therefore I only obtained to make this in the relationships one-to-many...