Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @PrivateOwned is not deleting records in one-to-many (unidirectional) join table

It does not matter when the table was created for @PrivateOwned.

What error are you getting?



sdt_dev wrote:
> 
> Hello James,
> 
> I am facing a similar problem where using @PrivateOwned is not deleting
> records in a bidirectional @OneToMany assoication.
> 
> and I am using EclipseLink1.1
> 
> I tried the suggestions like removing the cascade remove, but still the
> records of the list objects do not get deleted.
> but in my case, the table already exists for this particualr entity and
> the table also has records in the database. I added the @PrivateOwned
> annotation to the mapping after the table was created and new records were
> enetered. I am trying deletion of entities only now.
> 
> so does it matter that the table for the enetity already exists before
> adding the @PrivateOwned annotation, if so how do I specify that this
> particualr mapping association should be treated as PrivateOwned.
> 
> Thanks for any inputs towards this...
> 
> Greetings!
> sdt_dev
> 
>  
> 
> 
> James Sutherland wrote:
>> 
>> I think this issue was fixed, you can try the latest release.
>> 
>> Otherwise, try removing the cascade all (or at least cascade remove),
>> this should resolve the issue.
>> 
>> You could also remove the children from the collection, call flush, then
>> delete the objects.
>> 
>> 
>> Venkateswara Rao Alla wrote:
>>> 
>>> I've problem with @PrivateOwned as it is not deleting the mapping
>>> records in
>>> the Join table for an unidirectional one-to-many association (to be
>>> specific, this one-to-many association is a self one, meaning to the
>>> same
>>> table)
>>> 
>>> Below is the config I'm using
>>> 
>>> @Entity
>>> @Table("CONTERM")
>>> public class Contract extends BasicEntity {
>>>  private String name;
>>>  @OneToOne
>>> @JoinColumn(name="PARENT_ID", referencedColumnName="ID")
>>> private Contract parent;
>>>  @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
>>> @PrivateOwned
>>> private List<Contract> child;
>>>         .....
>>> }
>>> 
>>> Deletes for the child records were issued, but failed to delete the join
>>> table rows and giving constraint error.
>>> 
>>> com.ibm.db2.jcc.am.fo: DB2 SQL Error: SQLCODE=-532, SQLSTATE=23504,
>>> SQLERRMC=DB2USR.CONTERM_CONTERM.FK_CONTERM_CONTERM_CHILD_ID,
>>> DRIVER=3.57.82
>>> at com.ibm.db2.jcc.am.bd.a(bd.java:672)
>>> at com.ibm.db2.jcc.am.bd.a(bd.java:60)
>>> at com.ibm.db2.jcc.am.bd.a(bd.java:127)
>>> 
>>> I am using EclipseLink1.1 & DB2 v9.7
>>> 
>>> Thanks for any info.
>>> 
>>> Venki
>>> 
>>> 
>>> 
>> 
>> 
> 
> 


-----
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 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/%40PrivateOwned-is-not-deleting-records-in-one-to-many-%28unidirectional%29-join-table-tp29759309p30653745.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top