Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] not-null violation persisting unidirectional @OneToMany with @JoinColumn(nullable=false)

I think this is the bug you are looking for:

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

On 28/08/2013 5:52 AM, Andreas Joseph Krogh wrote:
Hi.
 
I'm having this mapping:
 
    @OneToMany(fetch = FetchType.LAZY, cascade = Array(CascadeType.ALL), orphanRemoval = true)
    @JoinColumn(name = "owner_id", nullable = false)
    private List<Car> carList;
 
According to this http://stackoverflow.com/a/12763199 EL will update the owner_id in a separate statement, triggering the not-null violation unless one has defferred not-null constraints.
 
This really is counter-intuitive having nullable=false on the @JoinColumn, clarely indicating that EL should insert the value as part of the INSERT-statement for the entity defining the @OneToMany association.
 
Is there a way to get around this, keeping the association unidirectional and not having to make the not-null constraint defferable?
 
Shall I file a bug?
 
Thanks.
 
--
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