Sorry, I made a typo:
This Car Entity has a relationship like this: => This *User*
Entity has a relationship like this:
On Thursday, August 14, 2014 2:30:46 AM UTC+2, Michael Azerhad wrote:
>
> Hi,
>
> Using SDN 3.1.2, I came across a weird behavior.
>
> Let's take this example:
>
> I've got a User entity (@NodeEntity) that I create and save.
> This well works, I have my User in the graph.
>
> This Car Entity has a relationship like this:
>
> @RelatedTo(`type` = "KNOWS", direction = Direction.OUTGOING)
> var friends: java.util.Set[User] = new util.HashSet[User]
>
>
> This relationship is populated after the user is created in an Akka actor
> like so:
>
>
> def receive = {
> case event: UserCreatedEvent =>
> val concernedUser = event.user
> val concernedUserFriends = ..... //find friends from
> userRepository, since they are users too
> val tx = graphDatabaseService.beginTx();
> try {
> concernedUser.friends.clear() // to be sure that the list
> is fully updated if was not empty (although not fetched)
> concernedUser.friends.addAll(concernedUserFriends)
> //populating
> the friends list
> log.info(concernedUserFriends) //in order to be sure in my
> console that friends are always found, and this is always the case
> userRepository.save(user) //update the user with this
> collection of friends
> tx.success()
> }
> finally {
> tx.close()
> }
> }
>
>
> However, although there are always friends to populate, the user doesn't
> ALWAYS end up with the relationship in database => no friends at all ...
> I would say 1/3 of success.
>
> Would it be addAll() that may not appropriate??
>
> Thanks a lot,
>
> 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.