-->
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: Reading MySQL Database Constraints by Nhybernate?
PostPosted: Thu Aug 11, 2011 8:34 am 
Newbie

Joined: Thu Aug 11, 2011 7:46 am
Posts: 2
we use mysql (or any databse). Naturally some fields have constraints like NOT NULL DEFAULT '5'


during xml mapping for table A has field c with not null constraint we get error on insert because
hybernate do not use constraints from the database.

What is the solution on mapping any attribute missing here to tell nhybernate read value of field and use as default on insert?


any help?

thanks


ag


Top
 Profile  
 
 Post subject: Re: Reading MySQL Database Constraints by Nhybernate?
PostPosted: Fri Aug 12, 2011 8:37 am 
Newbie

Joined: Thu Aug 11, 2011 7:46 am
Posts: 2
I found the answer

use

generated="always" in property mapping:)


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.