Hi Esteban,

thank you for the solution with the VOMongoToOneDescription.
This works perfect for me.

I have to come back to the circular references.
I am not sure if this is a bug.

I have the following model:

Trip ->> Day <->> VehicleTrip

One Trip has N Days.
One Day has N VehicleTrips.
The VehicleTrip points back to its Day.
The Trip is voyageRoot.

But I dont want Day or VehicleTrip to be voyageRoot, too.
(In my opinion this does not make sense).

If I try to save the trip, I get the endless loop.
Attention, the Image freezes then. :-)

How would you solve this? Also with the VOMongoToOneDescription solution?
You can reproduce it with the fileout below.

Regards
Sabine

This is the fileout:

Object subclass: #Day
        instanceVariableNames: 'date vehicleTrips'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'RKA24-Demo'!

!Day methodsFor: 'accessing' stamp: 'sabineknoefel 8/12/2013 11:13'!
date: anObject
        
        date := anObject! !

!Day methodsFor: 'accessing' stamp: 'sabineknoefel 8/12/2013 11:15'!
vehicleTrips: anObject
        
        vehicleTrips := anObject! !


Object subclass: #VehicleTrip
        instanceVariableNames: 'day description'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'RKA24-Demo'!

!VehicleTrip methodsFor: 'accessing' stamp: 'sabineknoefel 8/12/2013 11:13'!
day: anObject
        
        day := anObject! !

!VehicleTrip methodsFor: 'accessing' stamp: 'sabineknoefel 8/12/2013 11:14'!
description: anObject
        
        description := anObject! !


Object subclass: #Trip
        instanceVariableNames: 'days description'
        classVariableNames: ''
        poolDictionaries: ''
        category: 'RKA24-Demo'!

!Trip methodsFor: 'accessing' stamp: 'sabineknoefel 8/12/2013 11:14'!
days: anObject
        
        days := anObject! !

!Trip methodsFor: 'accessing' stamp: 'sabineknoefel 8/12/2013 10:12'!
description: anObject
        
        description := anObject! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

Trip class
        instanceVariableNames: ''!

!Trip class methodsFor: 'as yet unclassified' stamp: 'sabineknoefel
8/12/2013 11:15'!
demo
        |theTrip theDay theVehicleTrip|
        theTrip := Trip new description: 'Trip to Munic'.
        theDay := Day new date: Date today.
        theVehicleTrip := VehicleTrip new description: 'with car to fair'.
        theVehicleTrip day: theDay.
        theTrip days: (OrderedCollection with: theDay).
        theDay vehicleTrips: (OrderedCollection with: theVehicleTrip ).
         
        theTrip halt save ! !

!Trip class methodsFor: 'as yet unclassified' stamp: 'sabineknoefel
8/12/2013 09:47'!
isVoyageRoot 
        ^true! !

 



        |theTrip theDay theVehicleTrip|
        theTrip := Trip new description: 'Trip to Munic'.
        theDay := Day new date: Date today.
        theVehicleTrip := VehicleTrip new description: 'with car to fair'.
        theVehicleTrip day: theDay.
        theTrip days: (OrderedCollection with: theDay).
        theDay vehicleTrips: (OrderedCollection with: theVehicleTrip ).
         
        theTrip inspect 



--
View this message in context: 
http://forum.world.st/Voyage-Circular-references-tp4691940p4703303.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to