-->
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: ManyToOne(optional=true) VS JoinColumn( nullable = true)
PostPosted: Thu Nov 08, 2007 9:26 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 11:36 am
Posts: 24
@ManyToOne(optional=true)
@JoinColumn( nullable = true)

What is the purpose/difference of optional and nullable?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 09, 2007 6:29 am 
Newbie

Joined: Fri Nov 09, 2007 6:09 am
Posts: 1
Quote:
@ManyToOne(optional=true)
@JoinColumn( nullable = true)

What is the purpose/difference of optional and nullable?



@ManyToOne(optional=true) is for a association, that means there may be not a target for the src. When you using a third table to implments the one-to-one association, that means there may be not a row to represent it.
in this case, your can't set a @JoinColumn( nullable = true) to it.

@JoinColumn( nullable = true) means you should set the column to be null.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 11, 2007 12:26 am 
Beginner
Beginner

Joined: Tue Jul 03, 2007 11:36 am
Posts: 24
Is it the 2 annotation also indicate the same thing? i really do not understand when should i use optional and nullable? which one is used to generate the ddl?


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.