View Full Version : Circular object graphs in Hibernate
Sep 25th, 2004, 02:37 PM
Hello all. I'm having a little trouble, and I can't seem to find any info on what I need. Hopefully someone here can set me straight.
I have three classes:
If I am using a basic DAO as shown in the documentation, can I not simply pass an instance of ClassA to the save method to save the entire object graph? I have no problems saving any one of the individual instances. But when I try to save the graph, I get an exception about a non-persistent instance of classB.
I'd appreciate any help.
Sep 26th, 2004, 06:33 AM
You need to save individual instances, or else turn on cascading save (and deletes, etc.) as appropriate.
This is actually very much a Hibernate question and not really Spring releated. You can get a lot more Hibernate documentation and help by visiting the Hibernate site...
Sep 26th, 2004, 10:12 AM
I appreciate your response.
I've been over both sites fairly thoroughly, to no avail. I had come to the conclusion that cascading saves was what I needed, and had even found the configuration snippit on Hibernates site to turn this on. Unfortunately this is not directly transferable to my configuration, as a Spring file is responsible for holding the configuration for Hibernate, and it does not use the exact same manor for doing this. I have attempted a couple of different things trying to get cascades to work. All have failed.
So I am left wondering if Hibernate is the issue, or the integration of Hibernate into Spring. As I believe that Hibernate does not have a bug in its code preventing cascades from working, I'm left with the option of it being the integration of the two products, or more correctly, my misunderstanding of the inadequately documented integration of the two products.
That being the case, I felt that this forum was a logical starting place - as it was described as being a forum for data access integration and what-not - to try to correct my understanding of the integration. As I've not received any help here yet, I'll now try the Hibernate forums.
Again, thanks for your response.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.