Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Clarification of @ManyToOne(optional = false) semantics

Some discussion here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=298550

On 30/08/2013 11:06 AM, Andreas Joseph Krogh wrote:
Hi all.
 
In my @ManyToOne-mappings where the association is required, and I have a not-null constraint in the DB, I add the "optional = false" attribute. This however doesn't seem to be enough in EL and I get many "not null constraint violated"-errors in my app (ported from Hibernate). The remedy is to have "nullable = false" on the @JoinColumn-annotation.
 
I thought "nullable=false" on @JoinColumn was just a hint the to DDL-generation phase (whcih I'm not using, as I'm managing the db-schema using hand-written SQL-scripts) and had no practical meaning, but it certainly appears to be necessary to avoid not-null violations.
 
I'm wondering if this is according to spec, and is this how EL is supposed to work?
 
Thansk for any clarification.
 
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top