Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] ManyToOne support for ON DELETE SET NULL?

You can set this on your database table constraint if you wish, EclipseLink's
schema creation does not support "ON DELETE" constraints, so you would need
to define the table constraint yourself.

In general, you should avoid doing this.  You should be reading the objects
that reference the Attribute before deletion and set their attributes to
null.  This will ensure your object model is in synch with your data model.

You could also not define the relationship to the Attribute, and instead
query for it.

jandam wrote:
> ManyToOne support for ON DELETE SET NULL
> Does EclipseLink (1.1.2) support "ON DELETE SET NULL"
>     @JoinColumn(name = "ATTR_ID", referencedColumnName = "ID_ATTR")
>     @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE,
> CascadeType.REFRESH })
>     private Attribute    attribute;
> I need to delete entity "Attribute". Does EclipseLink support setting
> "attribute" to null?
>   Thank you for reply.
>   Martin

----- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top