-->
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: How to create nullable ManyToOne relationship?
PostPosted: Thu Aug 05, 2010 2:35 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Hello,

Is it possible to create nullable ManyToOne relationships?
I tried to set the nullable attribut on JoinColumn, and also tried optional=true, but anyway the DDL generated by Hibernate contains "NOT NULL" constraints.

Code:
    @JoinColumn(nullable = true)
    @ManyToOne(fetch = FetchType.EAGER)
    Flugzeug flugzeug;


Whats the proper way to make ManyToOne relationships nullable?

Thank you in advance, Clemens


Top
 Profile  
 
 Post subject: Re: How to create nullable ManyToOne relationship?
PostPosted: Thu Aug 05, 2010 3:59 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
The problem was @JoinColumn needs a name in order to make the other attributes work.

Thanks, Clemens


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.