-->
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 with hibernate annotations
PostPosted: Wed Feb 09, 2011 6:31 am 
Newbie

Joined: Wed Jan 19, 2011 11:01 am
Posts: 4
hey everyone. I am using hibernate 3 and hibernate-annotations and i have my classes exporting to a schema in postgres 8.4.
It is doing everything well, but i cant make it to generate the UPDATE CASCADE on foreign key id. In table Users i have:
@OnDelete(action = OnDeleteAction.CASCADE)
@ManyToOne(fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
@Cascade({org.hibernate.annotations.CascadeType.ALL})
@JoinColumn(name="id", unique = true, nullable = false, updatable = false, insertable = false)
public Contacts getContacts() {
return this.contacts;
}

In table Contacts i have:
@OnDelete(action = OnDeleteAction.CASCADE)
@JoinColumn(name = "id")
@OneToMany(fetch = FetchType.LAZY, mappedBy = "contacts", cascade = {CascadeType.ALL})
@Cascade({org.hibernate.annotations.CascadeType.ALL})
public Set<Users> getUsers() {
return this.users;
}

Can anybody help me?
thnx
Mark


Top
 Profile  
 
 Post subject: Re: Update Cascade with hibernate annotations
PostPosted: Wed Feb 09, 2011 10:36 am 
Regular
Regular

Joined: Fri Jan 28, 2011 11:44 am
Posts: 117
Hi,

I'm not sure I understood your problem correctly, so my question might be stupid ...
But why setting updatable to false in the JoinColumn annotation if your goal is to update the FK?


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.