-->
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: Declare Final Columns
PostPosted: Wed Sep 14, 2011 2:49 am 
Newbie

Joined: Sat Sep 03, 2011 4:46 am
Posts: 6
Hello,

I want to declare one of my columns as final. I want that the column is written on an insert but not on an update. The column is a foreign key representing a many-to-one reference in my mapping.
Therefore I found the alter table constraint ON UPDATE NO ACTION.
Is there Hibernate xml mapping support for that? I could not find any attribute on
Code:
many-to-one
in Hibernate 3.5.6.
As we use the hbm to generate our sql schema we have to declare it there.

What way of preventing column updates does hibernate support?

regards


Top
 Profile  
 
 Post subject: Re: Declare Final Columns
PostPosted: Wed Sep 14, 2011 3:42 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Use <many-to-one ... update="false" ...> in your hbm.xml. It will not generate the constraint but Hibernate will not include the column in update statements.


Top
 Profile  
 
 Post subject: Re: Declare Final Columns
PostPosted: Wed Sep 14, 2011 5:08 am 
Newbie

Joined: Sat Sep 03, 2011 4:46 am
Posts: 6
Thank you for your reply. Will check this out soon.

edit: Worked fine. Thanks mate.


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.