I am interested in this too. I am using Neo4j 2.0.1 and SDN 3.0.0.RELEASE . 
I am experiencing the same behaviour:

//When the Node is retrieved images.size() is 3 and the correct images are 
present.
@NodeEntity
public class SponsorNode {
    
    @RelatedTo(type="BRAND_IMAGE", direction=Direction.OUTGOING)
    @Fetch
    private Set<ImageNode> images;
}

//If I now fetch the sponsor node images.size() == 1, if I run 
template.fetch(images) then images.size() == 1 (but all attributes are 
populated).
@NodeEntity
public class SponsorNode {
    
    @RelatedTo(type="BRAND_IMAGE", direction=Direction.OUTGOING)
    private Set<ImageNode> images;
}

Did you find the root of your problem Michael?

On Sunday, 2 February 2014 22:27:56 UTC, Michael Azerhad wrote:
>
> Maybe it's an incompatibility with Scala. 
>
> I spent all day long to explain a possible reason why fetching only 
> returns the first collection's element.
>
> Could anyone confirm me this assumption:
> I precise I use SDN 3.0.0-RC1 with the simple object mapping:
>
> *If my first action is to create and save a `Meeting` object, *
> *then I don't need to save it anymore to be able to fetch the future 
> relationships made by adding some `Participation`s independently.*
> *In other word, does fetching for last values require the Meeting object 
> to be saved/updated again after Participations were added?*
>
> Thanks a lot
>
> On Sunday, February 2, 2014 3:29:45 PM UTC+1, Michael Azerhad wrote:
>>
>> I use Scala.
>>
>> In my class Meeting, I have this relation:
>>
>> @RelatedTo(`type` = "TO", direction = Direction.INCOMING)
>>   var _participants: java.util.Set[Participation] = _
>>
>> Participation is another node entity, linked to Meeting with an outgoing 
>> relationship "TO".
>>
>> What I do is a simple test saving firstly a Meeting, and then saving 
>> three distinct Participations related to it.
>>
>> I expect then to have a size of 3 when I do at the end of the process:  
>> neo4jTemplate.fetch(meetingRepository.findById(justSavedMeetingId).
>> _participants)
>>
>> However, it only returns the first Participation that was linked to. Not 
>> the two others....
>>
>> Note that it well works (size of 3 retrieved) when I add @Fetch, without 
>> explicitly using neo4jtemplate.fetch:
>>
>> @Fetch @RelatedTo(`type` = "TO", direction = Direction.INCOMING)
>>   var _participants: java.util.Set[Participation] = _  //works
>>
>> I tested it in the same transaction and in distinct transaction. 
>>
>> Am I missed something obvious?
>>
>> Thanks,
>>
>> Michael
>>
>> On Sunday, February 2, 2014 3:53:54 AM UTC+1, Michael Azerhad wrote:
>>>
>>> Hello,
>>>
>>> My question is pretty simple:  
>>> May it be a normal scenario when neo4jTemplate.fetch returns ALWAYS the 
>>> first collection's element?  (concerning a @RelatedTo collection's field 
>>> without any @Fetch annotation)
>>>
>>> On the contrary, when @Fetch is placed, the whole collection is well 
>>> retrieved.
>>>
>>> I did a workaround by rather use a Cypher Query (annotation in my 
>>> repository) to load the collection, but I would like to know if this 
>>> scenario could be explained.
>>>
>>> Thanks,
>>>
>>> Michael
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to