Hi all,

  I'm experiencing a weird issue with SDN 3.2.1.

  The project is pretty basic, as are the models.

  I have, for example, three models, each of which are derived from a super 
class that's annotated with @NodeEntity and has a @GraphId.

  Let's say these models represent a Franchise, a Company and a Store. 
 Amongst other properties, a Company can have many Stores (as can a 
Franchise), and a Store can only have one Company or Franchise, so you have 
something like this:

public class Company {
  @RelatedTo(type="HAS_STORE", direction=Direction.OUTGOING, 
enforceTargetType=true)
  private Set<Store> stores;
  ...
}

and

public class Franchise{
  @RelatedTo(type="HAS_STORE", direction=Direction.OUTGOING, 
enforceTargetType=true)
  private Set<Store> stores;
  ...
}




and

public class Store {
  @RelatedTo(type="HAS_STORE", direction=Direction.INCOMING, 
enforceTargetType=true)
  private Franchise;

  @RelatedTo(type="HAS_STORE", direction=Direction.INCOMING, 
enforceTargetType=true)
  private Company;
  ...
}


  I also have a repository defined thusly:

public interface StoreRepository extends GraphRepository<Store>, 
RelationshipOperationsRepository<Store> {
...
}


  Now, in a test case, when I try to do something like this:

Company company = new Company();
Store store = new Store();
store.setCompany(company);
...
storeRepository.save(store);

  ...I get an inconsistent result in that the relationship between Store 
and Company isn't always created (I'd say it's a 50/50 shot).  All of my 
other properties (including other relationships and collections) that I set 
on the store persist just fine every time.

  However, if I *rename* one of the relationships (say, the Franchise one 
to "FRANCHISE_HAS_STORE"), the issue goes away.  I was under the impression 
that the "enforceTargetType" argument in @RelatedTo was supposed to 
eliminate the need to rename the relationship types.

  Admittedly I haven't used SDN much in the last several months, so, please 
forgive me if I'm missing something.

  Anyone have any insight?

  Thanks in advance!

-- 
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