Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @ManyToOne(optional=false) versus @Column(nullable=false)

Okay but this doesn't seem to prevent entities with null relationships from
being saved. Are you saying that in-memory validation only occurs when
entities are loaded from the database? Shouldn't validation also take place
when you're saving?

Gili


Gordon Yorke-2 wrote:
> 
> Our interpretation of the optional "optional" (that's not a typo) 
> attribute is that it is intended to be in-memory validation and not 
> impact on DDL generation as there is a specific DDL attribute 
> "nullable=false"
> --Gordon
> 
> cowwoc wrote:
>> Oops, I hit send too soon. The question should read:
>>
>> I was under the impression that @ManyToOne(optional=false) will create
>> non-null columns, but it seems that it doesn't. Adding a
>> @JoinColumn(nullable=false) fixes the problem but then I'm left wondering
>> what optional=false is supposed to be doing...?
>>
>> Is this a bug or a misunderstanding?
>>
>> Thank you,
>> Gili
>>
>>
>> cowwoc wrote:
>>   
>>> Hi,
>>>
>>> I was under the impression that @ManyToOne(optional=false) versus
>>> @Column(nullable=false) will yield non-null columns, but it seems that
>>> @ManyToOne(optional=false) creates a nullable column.
>>>
>>> Is this a bug or a misunderstanding?
>>>
>>> Thank you,
>>> Gili
>>>
>>>     
>>
>>   
> 
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 

-- 
View this message in context: http://www.nabble.com/%40ManyToOne%28optional%3Dfalse%29-versus-%40Column%28nullable%3Dfalse%29-tp20930371p20939066.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top