-->
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.  [ 3 posts ] 
Author Message
 Post subject: Schema Export with "on update" (either cascade or
PostPosted: Wed Dec 21, 2005 11:51 am 
Newbie

Joined: Sat Nov 05, 2005 1:24 am
Posts: 5
Hi,

I am using Hibernate 3.1 (and annotations 3.1beta7) and wanted Hibernate to create my tables automatically defining the "on update" to cascade (or no action, in some cases) for foreign keys constraints. I searched all over the documentation, but couldn't make it work. It creates the foreign key without specifying the behaviour for "on update", what I would like to happen.

Is it possible in hibernate? How could I do that (with annotations, if possible)?

Thank you very much,

Rodrigo


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 1:15 pm 
Beginner
Beginner

Joined: Thu Sep 01, 2005 7:43 am
Posts: 31
Location: León (Spain)
Not all operations are able to cascade, so cascade has to be set in a per-property basis. I don't use annotations, but if you edit your .hbm.xml files, you can set the property cascade="update" for the collection mappings.

You can read the Hibernate online docs for more in-depth explanation.

Bye.

_________________
Please rate...

Expert on Hibernate errors... I've had them all... :P


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 1:23 pm 
Newbie

Joined: Sat Nov 05, 2005 1:24 am
Posts: 5
Hector_Lopez wrote:
Not all operations are able to cascade, so cascade has to be set in a per-property basis. I don't use annotations, but if you edit your .hbm.xml files, you can set the property cascade="update" for the collection mappings.


Thanks, Hector. I actually defined as follows, which should be equivalent to cascade="save-update":

@ManyToOne

@Cascade(value={CascadeType.SAVE_UPDATE})

@JoinColumn(name="TAKER",nullable=false)


Defining the cascade when a save or update happens, but still it doesn't create the foreign key for that as "on update cascade".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.