-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Table creation in the Data base with Hibernate
PostPosted: Wed May 23, 2007 10:11 am 
Newbie

Joined: Wed May 23, 2007 9:56 am
Posts: 1
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.