sim51/logisima-play-neo4j — Issue #15: Can't access related objects from both sides of the relationship
Author: jph303
Created: 2012-02-05 20:08:22+00:00
State: open

If I have the following models: State and Location they are related using the following annotation

public class State extends BaseModel
{
public String name;
public String abbreviation;

@Neo4jRelatedTo("STATE_LOCATION")
public List locations;
}

public class Location extends BaseModel
{
public String line1;
public String line2;
public String city;

@Neo4jRelatedTo(value = "STATE_LOCATION", direction = "INCOMING" )
public List states;
}

I can access a specific location by state.locations.get(0) but i cannot access location.states.get(0) states is always null. SO currently i would need to get the location id from my location object then search all the states and there locations for a match. Any ideas how we can resolve this?