I am faced with quite a challenge here.
I have the objects ClientProfile and Subscription:
The ClientProfile contains a collection of Subscriptions:
______________________________________________________________________
public class ClientProfile implements Serializable {
@OneToMany(mappedBy = "clientProfile", cascade={CascadeType.MERGE,
CascadeType.PERSIST})
private List<Subscription> subscriptionCollection;
public ClientProfile() {
}
public List<Subscription> getSubscriptionCollection() {
return subscriptionCollection;
}
public void setSubscriptionCollection(List<Subscription>
subscriptionCollection) {
this.subscriptionCollection = subscriptionCollection;
}
}
______________________________________________________________________
public class Subscription implements Serializable {
@ManyToOne
@JoinColumn(name = "client_profile_id", referencedColumnName = "id")
private ClientProfile clientProfile;
public Subscription() {
}
public ClientProfile getClientProfile() {
return clientProfile;
}
public void setClientProfile(ClientProfile clientProfile) {
this.clientProfile = clientProfile;
}
}
Now if I want to push this down via a webservice, everytime I try I get “A
cycle is detected in the object graph”. Now I understand why this is
happening but then I try and set the client profile inside the subscription
collection to Null (to break the graph) I am getting a constraint failure
because of the foreign key. It is as if when I set the client profile value
inside subscription it wants to perform an update.
Does anyone know how to get round this? How do I send this to my client app
with the clientProfile and it’s subscription list in tact?
________________
Thanks and regards
Kenneth Clark
Solutions Engineer
ShadowLogo.png
Tel: 27 11 679 3075
Mobile: 27 (0) 84 583 1348
Email: HYPERLINK
"mailto:kenneth.clark_at_skyetech.co.za"kenneth.clark_at_skyetech.co.za
Website:
http://www.skyetech.co.za
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.15.22/1111 - Release Date: 2007/11/05
04:36