-->
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.  [ 2 posts ] 
Author Message
 Post subject: Update Cascade.. how??
PostPosted: Mon Apr 28, 2008 8:39 am 
Newbie

Joined: Mon Apr 28, 2008 8:33 am
Posts: 2
im a new user from hibernate..

i need update in cascate..

example:

CREATE TABLE emprestimos
(
emprestimo_id int4 NOT NULL,
emprestimo_total float8 NOT NULL,
agenciafk_id int4 NOT NULL,
CONSTRAINT emprestimos_pkey PRIMARY KEY (emprestimo_id),
CONSTRAINT fkbb08884d7d90bc1 FOREIGN KEY (agenciafk_id)
REFERENCES agencias (agencia_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
)

how i change ON UPDATE NO ACTION to CASCADE??

how i change the name of CONSTRAINT fkbb08884d7d90bc1 FOREIGN KEY (agenciafk_id).

tks for all


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 28, 2008 3:41 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I guess it depends how you configure hibernate (xml vs. annotations) and which db you are using.

Assuming you are using annotations you should look into specifying the right cascade type on your collection, eg @OneToMany(cascade = CascadeType.ALL). The name of the constraint can be changed via @ForeignKey(name = "YOUR_FK_NAME").

If you need more help you should probably post your entity and how you configure it.

--Hardy


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

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.