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
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://old.nabble.com/ManyToOne-support-for-ON-DELETE-SET-NULL--tp27757258p27837008.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top