Nope .. it didnt work. Does this need some property in persistence.xml also ?
My new entity looks like this now
CampaignTarger.class
@ManyToOne(targetEntity=Campaign.class, fetch = FetchType.LAZY )
@JoinColumn(name = "campaign_Ref" ,nullable=true)
@ForeignKey(deleteAction=ForeignKeyAction.NULL)
private Campaign campaign ;
Campaign.class
@OneToMany(targetEntity=CampaignTarget.class, mappedBy = "campaign",
fetch=FetchType.LAZY )
private Collection<CampaignTarget> campaignTargets;
This is the complete stacktrace
Caused by: java.lang.Exception: <openjpa-1.1.0-r422266:657916 nonfatal store
error> org.apache.openjpa.util.StoreException: [BEA][Oracle JDBC
Driver][Oracle]ORA-02292: integrity constraint
(XXX.FK_CAMPAIGNTARGET_CAMPAIGN) violated - child record found
{prepstmnt 1705 DELETE FROM Campaign_T WHERE ID = ? AND version = ?
[params=(String) 1002, (int) 1]} [code=2292, state=HY000]
FailedObject: com.tieto.tix.imaging.domain.Campaign-1002
at
org.apache.openjpa.util.Exceptions.replaceNestedThrowables(Exceptions.java:249)
at
org.apache.openjpa.util.OpenJPAException.writeObject(OpenJPAException.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
Persistence Unit looks like this in xml
<persistence-unit name="imagingDS" transaction-type="JTA">
<jta-data-source>imagingDS</jta-data-source>
<properties>
<property name="openjpa.jdbc.DBDictionary"
value="oracle(UseGetBytesForBlobs=true,maxEmbeddedBlobSize=-1,maxEmbeddedClobSize=-1)"/>
<property name="openjpa.jdbc.SubclassFetchMode" value="none"/>
</properties>
</persistence-unit>
--
View this message in context:
http://n2.nabble.com/How-to-specifiy-Cascase-None-for-OneToMany-tp4426059p4431913.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.